Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class T>
- void foo(size_t n, const T& value)
- {
- T* buffer = reinterpret_cast<T*>(new char[n * sizeof(T)]);
- for (int i = 0; i < n; i++) {
- buffer[i] = value;
- std::cout << buffer[i] << std::endl;
- }
- std::cout << "success" << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement