0
votes

Having:

#include <typeinfo>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/pop_front.hpp>
int main()
{
    typedef boost::mpl::vector<char,short,int,long,long long> v;
    typedef typename pop_front<v>::type poped;
}

the problem is that poped is not equal to boost::mpl::vector< short,int,long,long long > but to: boost::mpl::v_mask< boost::mpl::vector< char,short,int,long,long long>>

How shall I make it to return vector without first element?

2
Why do you care what the exact resulting type is? It behaves as an mpl::vector<>, and you can treat it as one, so what's the difference? - ildjarn
@ildjarn just curiosity, nothing bad in being curious is there? - smallB
Absolutely not! :-] I was just wondering what actual problem this was causing for you. - ildjarn

2 Answers

1
votes

Maybe mpl::equal can help you clarify why this doesn't really matter at all.

Just make sure it's equal, but not necessarily the same.

BOOST_MPL_ASSERT((mpl::equal<
    typename pop_front<v>::type,
    mpl::vector<short,int,long,long long>
>));

That is all you really need ;-)

0
votes

I am not sure this is possible using MPL features. Even if you tried copying poped into a vector using copy and a back_inserter, you would once again obtain a type which is not really a vector. This is by design: like in Boost.Fusion, MPL's algorithms and metafunctions return views over the original sequence, providing lazy evaluation. These views can be used like the original sequences, so you should not worry about what their actual types are and simply use them as if they were vector (or lists, or maps, etc.).