Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-03-02 18:37:09


Hi,

This code:

#include <boost/mpl/vector.hpp>
#include <boost/mpl/pop_front.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/equal.hpp>

using namespace boost;

// Doc says: pop_front returns a vector
typedef mpl::pop_front< mpl::vector<bool,char,int> >::type v;

// Doc says: vectors have a type member equal to itself
BOOST_MPL_ASSERT((
   mpl::equal< v, v::type >
));

fails to compile with GCC ( v::type is mpl::vector3<bool,char,int> ) and
compiles fine with other compilers.

Examples for false conclusions that could be easily drawn from the
current documentation:

  "Oh great - I do not need mpl::identity when using v with
   mpl::eval_if"

  "Let's inherit from 'v::type' so I can save the '::type' later"

  "::type always gives the numbered form of my current sequence so
   I can use it with partial specialization"

I got trapped by this in two different places (and I still hope not to
be surpassingly stupid ;-). Shouldn't this behaviour be documented in
some way ?

Regards,

Tobias


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk