0

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?

Luc Touraille
  • 79,925
  • 15
  • 92
  • 137
smallB
  • 16,662
  • 33
  • 107
  • 151
  • 1
    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 Oct 29 '11 at 17:35
  • 1
    @ildjarn just curiosity, nothing bad in being curious is there? – smallB Oct 29 '11 at 17:45
  • Absolutely not! :-] I was just wondering what actual problem this was causing for you. – ildjarn Oct 29 '11 at 17:47

2 Answers2

1

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 ;-)

Madera
  • 324
  • 1
  • 3
0

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.).

Luc Touraille
  • 79,925
  • 15
  • 92
  • 137