Hi!
The example in libs/mpl/example/tuple_from_list.cpp
and gen_linear_hierarchy from
http://aspn.activestate.com/ASPN/Mail/Message/boost/1166644
template< typename Types, typename Unit, typename Root = mpl::none >
struct gen_linear_hierarchy
{
typedef typename mpl::fold ::type type; // here
};
/* usage example:
template< class Base, class T >
struct EventHander : public Base
{
virtual void OnEvent(T& obj, int eventID) = 0;
};
typedef gen_linear_hierarchy<
mpl::list
, EventHander<_1,_2>
> ::type v;
*/
all seem to me work fine with default constructible types.
What I need is a type generator which provides a constructor, such that
code like this one works for mpl::vectors (or other mpl::sequences)
with arbitrary length:
-------------
class C { C(std::string const & gaga) {} };
struct gen_linear_hierarchy_with_constructor
// your idea missing here
{
// and here
};
typedef
gen_linear_hierarchy_with_constructor >::type mytuple;
mytuple mt("test", "Thanks for your help");
------------------
Markus
P.S.: David and Aleksey, if you read this here: I could not find your
"coming soon" book at awprofessional.com. What's the current state
of the book I wait for so long already ...