
On 08/01/12 20:18, Daniel Larimer wrote:
Julien, An extra 'byte' was just left over from me testing. It works with 8 bytes (2 ints) and it asserts on 7 bytes. I was trying to find a way to 'warn' if you reserved too much. It looks like BOOST_STATIC_WARN() has been removed.
I thought about alignment issues (I am no expert here), but my understanding is that structs/classes are always 'aligned' in the same manner regardless of what is stored. Therefore, if my fwd<> class only has one data member (an array) it should be aligned appropriately for any type.
I'm pretty sure that you're array, char fwd<T,S>::_store[S], has an alignment of 1; thus, If T is double, it would not be aligned properly. You need to use an aligned buffer, which boost provides and is also in the standard someplace. boost::variant uses the boost aligned buffer for its storage buffer. HTH. -regards, Larry