Compile-time Size of Struct Minus Padding
问题 I'm trying to use Boost MPL and Fusion to calculate the size of a struct exclusive of any padding. This is my current best attempt: Live example template<class T> constexpr std::size_t sizeof_members(void) { using namespace std; namespace mpl = boost::mpl; namespace fusion = boost::fusion; //This works, but only for structs containing exactly 4 members... typedef typename mpl::apply<mpl::unpack_args<mpl::vector<mpl::_1, mpl::_2, mpl::_3, mpl::_4>::type >, T>::type member_types; typedef