A simple object generator can be built automagically using the following family.
generator
is one of the
Function Builders which builds
an "object generator".
<pstade/egg/generator.hpp>
C(Lam)
is
Lam
without no nested type
if Lam
is an MPL
Placeholder Expression.
Lam
itself otherwise.
g
is an object of generator<Lam, R0, How, _Stg>::type
.
X
is boost::mpl::apply<C(Lam), _meta_arg_list(a,
_Stg)>::type
.
arglist
is _arg_list(a, _Stg)
.
Valid expression |
Semantics |
---|---|
|
A Major Function Object POD type |
|
A braced initializer of |
|
Returns an object made by |
|
Returns a |
Lam
is an (possibly cv-qualified)
MPL
Lambda Expression.
1 <=
N &&
N <=
BOOST_MPL_LIMIT_METAFUNCTION_ARITY
,
which has a default value 5
.
How
is _default
or one of the type in Generating
Forms.
g
with
static storage duration is statically initialized
if initialized using PSTADE_EGG_GENERATOR
.
g
is Default
Constructible and Assignable.
Note | |
---|---|
|
typedef generator< std::pair< deduce<boost::mpl::_1, as_value>, deduce<boost::mpl::_2, as_value> > >::type T_make_pair; T_make_pair const make_pair = PSTADE_EGG_GENERATOR; void test_generator() { BOOST_CHECK( make_pair(10, std::string("generator")) == std::make_pair(10, std::string("generator")) ); }
generator
generates an object
using constructor by default. You need these helpers if a generating type
has no constructor.
<pstade/egg/use_constructor.hpp>
defines use_constructor
.
<pstade/egg/use_brace1.hpp>
defines use_brace1
.
<pstade/egg/use_brace2.hpp>
defines use_brace2
.
Valid expression |
Semantics |
---|---|
|
|
|
|
|
|
Egg provides some basic and useful Metafunction Class types for better error messages. You can place any elaborate MPL Lambda Expression in generating type, though.
<pstade/egg/generator.hpp>
Valid expression |
Semantics |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 2007 Shunsuke Sogame |