Boost logo

Boost :

From: Hugo Duncan (hugoduncan_at_[hidden])
Date: 2004-09-15 11:28:08


    gcc (GCC) 3.3.3 (cygwin special)

there is a include order dependency. Including boost/bind.hpp before
boost/mpl/transform.hpp causes a compile error

    type named `type' in `struct
    boost::mpl::apply_wrap2<boost::mpl::push_front<mpl_::na, mpl_::na>,
    mpl_::arg<1>, wrapper<mpl_::arg<2> > >'

I have not been able to test with other gcc versions.


#include "boost/bind.hpp"
#include "boost/mpl/transform.hpp"

#include <boost/mpl/apply.hpp>
#include <boost/mpl/list.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/mpl/assert.hpp>

// computed type
template <typename T>
struct wrapper{};

// metafunction class to compute type
struct wrapped_type
   template <typename T>
   struct apply
     typedef wrapper<T> type;

void test_transform()
   typedef boost::mpl::list<int, char> typelist;
   typedef boost::mpl::list< wrapper<int>, wrapper<char> > wrapped_typelist;

   typedef boost::mpl::transform< typelist, wrapped_type >::type

   BOOST_MPL_ASSERT(( boost::mpl::equal<wrapped_typelist, result> ));

Boost list run by bdawes at, gregod at, cpdaniel at, john at