Given a MPL Random Access Container (typename Types) I want to make a static const std::size_t array which contains the sizeof each type in Types. How can I do this? Thanks, Michael Marcin
Hey clown! Try what I have below. //========================================================================================= #include <boost/mpl/vector.hpp> #include <boost/mpl/at.hpp> void MPLVectorTest() { using namespace boost::mpl; typedef vector<float,double,char,short,long> MixedVector; static const std::size_t sizes[] = { sizeof( at_c<MixedVector, 0>::type ), sizeof( at_c<MixedVector, 1>::type ), sizeof( at_c<MixedVector, 2>::type ), sizeof( at_c<MixedVector, 3>::type ), sizeof( at_c<MixedVector, 4>::type ) }; } On Nov 16, 2007 12:37 AM, Michael Marcin <mmarcin@method-solutions.com> wrote:
Given a MPL Random Access Container (typename Types) I want to make a static const std::size_t array which contains the sizeof each type in Types.
How can I do this?
Thanks,
Michael Marcin
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Bah, the type of the 'sizes' array is wrong, but you get the basic idea... On Nov 16, 2007 11:25 AM, Robert Dailey <rcdailey@gmail.com> wrote:
Hey clown! Try what I have below.
//========================================================================================= #include <boost/mpl/vector.hpp> #include <boost/mpl/at.hpp>
void MPLVectorTest() { using namespace boost::mpl;
typedef vector<float,double,char,short,long> MixedVector;
static const std::size_t sizes[] = { sizeof( at_c<MixedVector, 0>::type ), sizeof( at_c<MixedVector, 1>::type ), sizeof( at_c<MixedVector, 2>::type ), sizeof( at_c<MixedVector, 3>::type ), sizeof( at_c<MixedVector, 4>::type ) };
}
On Nov 16, 2007 12:37 AM, Michael Marcin <mmarcin@method-solutions.com> wrote:
Given a MPL Random Access Container (typename Types) I want to make a static const std::size_t array which contains the sizeof each type in Types.
How can I do this?
Thanks,
Michael Marcin
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Michael Marcin
-
Robert Dailey