Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2007-11-16 12:25:44


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_at_[hidden]>
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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net