[C++-sig] Exposing 128-bit aligned datatype

VáclavŠmilauer eudoxos at arcig.cz
Mon Feb 20 11:13:18 CET 2012


I am exposing a struct which is 128-bit aligned to python; it is always
constructed dynamically in c++ code, hence there is no trouble that the
alignment is correct. I was getting errors on compilation and had to add this
bit to my code:

namespace boost {
	namespace align { struct __attribute__((__aligned__(128))) a128 {};}
	template<> class type_with_alignment<128> { public: typedef align::a128 type; };
};

The wrapper works correctly. For some reason
boost/type_traits/type_with_alignment.hpp only defines alignment > 32 only for
MSVC or Intel compilers. I am not sure where to ask for fix, can someone forward
this to the right place?

The aligned type is cl_double16, compiling with gcc.

Cheers, Vaclav




More information about the Cplusplus-sig mailing list