Boost logo

Boost Users :

From: Markus Werle (numerical.simulation_at_[hidden])
Date: 2004-06-29 06:08:02


The example in libs/mpl/example/tuple_from_list.cpp
and gen_linear_hierarchy from

    template< typename Types, typename Unit, typename Root = mpl::none >
    struct gen_linear_hierarchy
        typedef typename mpl::fold<Types,Unit,Root> ::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<
        , 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

gen_linear_hierarchy_with_constructor<mpl::vector<C, C> >::type mytuple;

mytuple mt("test", "Thanks for your help");


P.S.: David and Aleksey, if you read this here: I could not find your
"coming soon" book at What's the current state
of the book I wait for so long already ...

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