There's reinterpret_cast, but it requires proper alignment, memmove doesn't.
Ben Voigt
2010-04-13 02:51:06
There's reinterpret_cast, but it requires proper alignment, memmove doesn't.
If you allocate an array of boost::variant, then you can allow multiple different types at each position; however, the amount of space allocated per element will be equal the maximum for all the possible types. Note though, that if you only use the primitive types and void*, then that doesn't waste that much space.
Hmm, since you are in C++, it sounds like you are looking for STL allocator and/or placement new.