|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-06-29 09:45:57
Markus Werle <numerical.simulation_at_[hidden]> writes:
> 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<mpl::vector<C, C> >::type mytuple;
>
> mytuple mt("test", "Thanks for your help");
> ------------------
>
What you really want is the fusion library (in CVS), which will
replace Boost.Tuple:
#include <boost/spirit/fusion/sequence/generate.hpp>
typedef
boost::fusion::result_of_generate<some_type_sequence>::type
mytuple;
I don't know of another (easy) solution for you.
> 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 ...
"Sanity-check reviewed" and about to enter final copyediting at
Addison Wesley.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
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