Boost logo

Boost Users :

Subject: [Boost-users] class composition
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-01-13 12:50:24


hello,
There is an example listed in "C++ template metaprogramming" to generate a class with its members from an mpl sequence:

template <typename T>
struct wrap { typedef T value; };

typedef mpl::vector< type1, type2, type3 > member_types;
mpl::inherit_linearly< member_types, mpl::inherit< wrap<_2>, _1 > >::type generated;

but then, the generated class did not look like this:

class C {
  type1 t1;
  type2 t2;
  type3 t3;
};

Can one do that with BOOST_PP and sequences from preprocessor libs instead?

regards,


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net