|
Boost : |
From: Andreas Brinck (andreas.brinck_at_[hidden])
Date: 2007-10-10 09:11:18
Hi,
I'm using Visual Studio 2005 and got into trouble when I tried to serialize
a class with 16 byte alignment:
__declspec(align(16)) class Vech
{
...
__m128 m_data;
};
The problem is that the following static assert in type_with_alignment is
triggered:
BOOST_STATIC_ASSERT(found % Align == 0);
which in turn stems from the fact that sizeof(max_align) == 8. By changing
the lines:
#define BOOST_TT_ALIGNMENT_BASE_TYPES BOOST_PP_TUPLE_TO_LIST( \
12, ( \
char, short, int, long, ::boost::long_long_type, float, double,
long double \
, void*, function_ptr, member_ptr, member_function_ptr))
to
#include <xmmintrin.h>
#define BOOST_TT_ALIGNMENT_BASE_TYPES BOOST_PP_TUPLE_TO_LIST( \
13, ( \
char, short, int, long, ::boost::long_long_type, float, double,
long double \
, void*, function_ptr, member_ptr, member_function_ptr, __m128))
I got rid of the static assert and everything seems to work just fine. Would
it be possible to get this "fix" into a later release of boost in a more
rigorous and organized fashion (with all the surrounding compiler
workarounds and typedefs etc.)?
Or is there another way to get the same effect?
Regards
/A.B.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk