Is there any portable way to determine what the maximum possible alignment for any type is?
For example on x86, SSE instructions require 16-byte alignm
This is what I'm using. In addition to this, if you're allocating memory then a new()'d array of char with length greater than or equal to max_alignment will be aligned to max_alignment so you can then use indexes into that array to get aligned addresses.
enum {
max_alignment = boost::mpl::deref<
boost::mpl::max_element<
boost::mpl::vector<
boost::mpl::int_::value>::type,
boost::mpl::int_::value>::type,
boost::mpl::int_::value>::type, boost::mpl::int_::value>::type,
boost::mpl::int_::value>::type,
boost::mpl::int_::value>::type,
boost::mpl::int_::value>::type,
boost::mpl::int_::value>::type
>::type
>::type
>::type::value
};
}