What can I use instead of std::aligned_alloc in MS Visual Studio 2013?
问题 I would like to use C++11's std::aligned_alloc , but unfortunately it isn't available with Microsoft Visual Studio 2013. I'm considering, intsead, implementing aligned_alloc on my own. How should an implementation look like? The following for example doesn't compile, because it cannot convert from void* to void*& . template<typename T> T* aligned_alloc( std::size_t size, std::size_t align ) { T* ptr = new T[size + align]; std::align(align, size, reinterpret_cast<void*>(ptr), align + size);