Boost logo

Boost Users :

From: Martin Apel (martin.apel_at_[hidden])
Date: 2008-06-19 08:07:06

Hi all,

I stumbled across something very strange related to boost::mpl::for_each
and numbered vectors and sets (as opposed to the variadic forms). The
program below contains a typelist with 21 (i.e. more than
BOOST_MPL_LIMIT_SET_SIZE) classes. This typelist is converted to a
typelist containing pointers to those classes. Finally the main program
calls for_each with that typelist to print the names of the types. This
works without problems on Linux and Windows. But now:
If you remove the include "boost/mpl/vector/vector30.hpp" everything
still compiles fine without warnings under both operating systems. On
Linux everything continues to work, whereas under Windows nothing is
printed anymore. for_each does not loop through the typelist for an
unknown reason. Everything works again, when reducing the number of
classes to 20 (and adjusting the include to set20.hpp).
 From my understanding BOOST_MPL_LIMIT_SET_SIZE and its brothers and
sisters should not have any impact on numbered sequences, only on
variadic ones. But still it looks as if something very strange is
happening here.

Any comments are welcome,


#include <iostream>
#include "boost/mpl/vector/vector30.hpp"
#include "boost/mpl/set/set30.hpp"
#include "boost/mpl/for_each.hpp"
#include "boost/mpl/transform.hpp"
#include "boost/mpl/inserter.hpp"
#include "boost/mpl/vector.hpp"
#include "boost/type_traits/add_pointer.hpp"

class C1;
class C2;
class C3;
class C4;
class C5;
class C6;
class C7;
class C8;
class C9;
class C10;
class C11;
class C12;
class C13;
class C14;
class C15;
class C16;
class C17;
class C18;
class C19;
class C20;
class C21;

   typedef boost::mpl::set21<C1,
> ElementClasses;

boost::mpl::push_back<boost::mpl::_1, boost::mpl::_2> > >::type

class Test
        boost::mpl::for_each<ElementClassesAsPointer> (*this);

    template<class T>
    void operator() (T x)
        std::cout << "Operator() called for type " << typeid(T).name()
<< std::endl;

int main(void)
    Test test;

Virus checked by G DATA AntiVirus
Version: AVKA 18.302 from 18.06.2008
Virus news:

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at