Merge remote-tracking branch 'origin/develop' into feature/constexpr
244
doc/adapted.qbk
@ -89,6 +89,35 @@ __std_pair_doc__, __tr1_tuple_pair__
|
||||
|
||||
[endsect]
|
||||
|
||||
[section std::tuple]
|
||||
|
||||
This module provides adapters for `std::tuple`. Including the module header
|
||||
makes `std::tuple` a fully conforming __random_access_sequence__.
|
||||
|
||||
[important To be fully conforming, compiler should support C++11 Variadic Templates.]
|
||||
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/adapted/std_tuple.hpp>
|
||||
#include <boost/fusion/include/std_tuple.hpp>
|
||||
|
||||
[heading Model of]
|
||||
|
||||
* __random_access_sequence__
|
||||
|
||||
[heading Example]
|
||||
|
||||
std::tuple<int, std::string, float> p(123, "Hola!!!", 456.f);
|
||||
std::cout << __at_c__<0>(p) << std::endl;
|
||||
std::cout << __at_c__<1>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
|
||||
[heading See also]
|
||||
|
||||
__std_tuple_doc__
|
||||
|
||||
[endsect]
|
||||
|
||||
[section mpl sequence]
|
||||
|
||||
This module provides adapters for __mpl__ sequences. Including the module
|
||||
@ -168,8 +197,8 @@ header makes `boost::tuple` a fully conforming __forward_sequence__.
|
||||
[heading Example]
|
||||
|
||||
boost::tuple<int,std::string> example_tuple(101, "hello");
|
||||
std::cout << *boost::fusion::begin(example_tuple) << '\n';
|
||||
std::cout << *boost::fusion::next(boost::fusion::begin(example_tuple)) << '\n';
|
||||
std::cout << *__begin__(example_tuple) << '\n';
|
||||
std::cout << *__next__(__begin__(example_tuple)) << '\n';
|
||||
|
||||
[heading See also]
|
||||
|
||||
@ -185,10 +214,20 @@ necessary boilerplate to make an arbitrary struct a model of
|
||||
__random_access_sequence__.
|
||||
|
||||
[heading Synopsis]
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
struct_name,
|
||||
member_name0,
|
||||
member_name1,
|
||||
member_name2,
|
||||
...
|
||||
)
|
||||
|
||||
// Without BOOST_PP_VARIADICS support :
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
struct_name,
|
||||
(member_type0, member_name0)
|
||||
(member_type1, member_name1)
|
||||
(BOOST_FUSION_ADAPT_AUTO, member_name2)
|
||||
...
|
||||
)
|
||||
|
||||
@ -196,9 +235,13 @@ __random_access_sequence__.
|
||||
|
||||
The above macro generates the necessary code to adapt `struct_name`
|
||||
as a model of __random_access_sequence__.
|
||||
The sequence of `(member_typeN, member_nameN)`
|
||||
pairs declares the type and names of each of the struct members that are
|
||||
part of the sequence.
|
||||
|
||||
The sequence of `member_nameN,` arguments or `(member_typeN, member_nameN)`
|
||||
pairs declares the type and names of each of the struct members that are part of
|
||||
the sequence.
|
||||
|
||||
When member_typeN is omitted or set to BOOST_FUSION_ADAPT_AUTO, the type is
|
||||
infered with Boost.TypeOf.
|
||||
|
||||
The macro should be used at global scope, and `struct_name` should be the fully
|
||||
namespace qualified name of the struct to be adapted.
|
||||
@ -208,7 +251,7 @@ namespace qualified name of the struct to be adapted.
|
||||
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
|
||||
[heading Example]
|
||||
[heading Example: BOOST_FUSION_ADAPT_STRUCT ]
|
||||
namespace demo
|
||||
{
|
||||
struct employee
|
||||
@ -221,8 +264,15 @@ namespace qualified name of the struct to be adapted.
|
||||
// demo::employee is now a Fusion sequence
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
demo::employee,
|
||||
(std::string, name)
|
||||
(int, age))
|
||||
name,
|
||||
age)
|
||||
|
||||
// Without BOOST_PP_VARIADICS support :
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
demo::employee,
|
||||
(BOOST_FUSION_ADAPT_AUTO, name)
|
||||
(BOOST_FUSION_ADAPT_AUTO, age)
|
||||
)
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -234,11 +284,21 @@ necessary boilerplate to make an arbitrary template struct a model of
|
||||
__random_access_sequence__.
|
||||
|
||||
[heading Synopsis]
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT(
|
||||
(template_param0)(template_param1)...,
|
||||
(struct_name) (specialization_param0)(specialization_param1)...,
|
||||
member_name0,
|
||||
member_name1
|
||||
...
|
||||
)
|
||||
|
||||
// Without BOOST_PP_VARIADICS support :
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT(
|
||||
(template_param0)(template_param1)...,
|
||||
(struct_name) (specialization_param0)(specialization_param1)...,
|
||||
(member_type0, member_name0)
|
||||
(member_type1, member_name1)
|
||||
(BOOST_FUSION_ADAPT_AUTO, member_name2),
|
||||
...
|
||||
)
|
||||
|
||||
@ -252,9 +312,12 @@ the template type parameters used.
|
||||
The sequence `(specialization_param0)(specialization_param1)...`
|
||||
declares the template parameters of the actual specialization of `struct_name`
|
||||
that is adapted as a fusion sequence.
|
||||
The sequence of `(member_typeN, member_nameN)`
|
||||
pairs declares the type and names of each of the struct members that are
|
||||
part of the sequence.
|
||||
The sequence of `member_nameN,` arguments or `(member_typeN, member_nameN)`
|
||||
pairs declares the type and names of each of the struct members that are part of
|
||||
the sequence.
|
||||
|
||||
When member_typeN is omitted or set to BOOST_FUSION_ADAPT_AUTO, the type is
|
||||
infered with Boost.TypeOf.
|
||||
|
||||
The macro should be used at global scope, and `struct_name` should be the fully
|
||||
namespace qualified name of the struct to be adapted.
|
||||
@ -272,6 +335,7 @@ namespace qualified name of the struct to be adapted.
|
||||
{
|
||||
Name name;
|
||||
Age age;
|
||||
int employment_timestamp;
|
||||
};
|
||||
}
|
||||
|
||||
@ -280,7 +344,16 @@ namespace qualified name of the struct to be adapted.
|
||||
(Name)(Age),
|
||||
(demo::employee) (Name)(Age),
|
||||
(Name, name)
|
||||
(Age, age))
|
||||
(Age, age)
|
||||
(BOOST_FUSION_ADAPT_AUTO, employment_timestamp))
|
||||
|
||||
// Or by infering type completely
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT(
|
||||
(Name)(Age),
|
||||
(demo::employee) (Name)(Age),
|
||||
name,
|
||||
age,
|
||||
employment_timestamp)
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -293,10 +366,31 @@ arbitrary struct a model of __random_access_sequence__. The given struct is
|
||||
adapted using the given name.
|
||||
|
||||
[heading Synopsis]
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
||||
struct_name, adapted_name,
|
||||
member_name0,
|
||||
member_name1,
|
||||
member_name2,
|
||||
...
|
||||
)
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(
|
||||
struct_name,
|
||||
(namespace0)(namespace1)...,
|
||||
adapted_name,
|
||||
member_name0,
|
||||
member_name1,
|
||||
member_name2,
|
||||
...
|
||||
)
|
||||
|
||||
// Without BOOST_PP_VARIADICS support :
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
||||
struct_name, adapted_name,
|
||||
(member_type0, member_name0)
|
||||
(member_type1, member_name1)
|
||||
(BOOST_FUSION_ADAPT_AUTO, member_name2),
|
||||
...
|
||||
)
|
||||
|
||||
@ -306,9 +400,12 @@ adapted using the given name.
|
||||
adapted_name,
|
||||
(member_type0, member_name0)
|
||||
(member_type1, member_name1)
|
||||
(BOOST_FUSION_ADAPT_AUTO, member_name2),
|
||||
...
|
||||
)
|
||||
|
||||
|
||||
|
||||
[heading Semantics]
|
||||
|
||||
The above macros generate the necessary code to adapt `struct_name`
|
||||
@ -321,9 +418,12 @@ If an empty namespace sequence is given (that is a macro that expands to
|
||||
nothing), the adapted view is placed in the global namespace.
|
||||
If no namespace sequence is given (i.e. `BOOST_FUSION_ADAPT_STRUCT_NAMED`), the
|
||||
adapted view is placed in the namespace `boost::fusion::adapted`.
|
||||
The sequence of `(member_typeN, member_nameN)`
|
||||
pairs declares the type and names of each of the struct members that are
|
||||
part of the sequence.
|
||||
The sequence of `member_nameN,` arguments or `(member_typeN, member_nameN)`
|
||||
pairs declares the type and names of each of the struct members that are part of
|
||||
the sequence.
|
||||
|
||||
When member_typeN is omitted or set to BOOST_FUSION_ADAPT_AUTO, the type is
|
||||
infered with Boost.TypeOf.
|
||||
|
||||
The macros should be used at global scope, and `struct_name` should be the fully
|
||||
namespace qualified name of the struct to be converted.
|
||||
@ -347,8 +447,14 @@ namespace qualified name of the struct to be converted.
|
||||
// referring to demo::employee
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
||||
demo::employee, adapted_employee,
|
||||
(std::string, name)
|
||||
(int, age))
|
||||
name,
|
||||
age)
|
||||
|
||||
// Without BOOST_PP_VARIADICS support :
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
||||
demo::employee, adapted_employee,
|
||||
(BOOST_FUSION_ADAPT_AUTO, name),
|
||||
(BOOST_FUSION_ADAPT_AUTO, age))
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -362,8 +468,8 @@ __random_access_sequence__ and __associative_sequence__.
|
||||
[heading Synopsis]
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
||||
struct_name,
|
||||
(member_type0, member_name0, key_type0)
|
||||
(member_type1, member_name1, key_type1)
|
||||
([member_type0,] member_name0, key_type0)
|
||||
([member_type1,] member_name1, key_type1)
|
||||
...
|
||||
)
|
||||
|
||||
@ -371,10 +477,13 @@ __random_access_sequence__ and __associative_sequence__.
|
||||
|
||||
The above macro generates the necessary code to adapt `struct_name`
|
||||
as a model of __random_access_sequence__ and __associative_sequence__.
|
||||
The sequence of `(member_typeN, member_nameN, key_typeN)`
|
||||
triples declares the type, name and key type of each of the struct members
|
||||
The sequence of `([member_typeN,] member_nameN, key_typeN)` tuples
|
||||
declares the type, name and key type of each of the struct members
|
||||
that are part of the sequence.
|
||||
|
||||
When member_typeN is omitted or set to BOOST_FUSION_ADAPT_AUTO, the type is
|
||||
infered with Boost.TypeOf.
|
||||
|
||||
The macro should be used at global scope, and `struct_name` should be the fully
|
||||
namespace qualified name of the struct to be adapted.
|
||||
|
||||
@ -404,8 +513,14 @@ namespace qualified name of the struct to be adapted.
|
||||
// keys keys::name and keys::age present.
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
||||
demo::employee,
|
||||
(std::string, name, keys::name)
|
||||
(int, age, keys::age))
|
||||
(name, keys::name)
|
||||
(age, keys::age))
|
||||
|
||||
// Without BOOST_PP_VARIADICS support :
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
||||
demo::employee,
|
||||
(BOOST_FUSION_ADAPT_AUTO, name, keys::name),
|
||||
(BOOST_FUSION_ADAPT_AUTO, age, keys::name))
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -420,8 +535,8 @@ __random_access_sequence__ and __associative_sequence__.
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
|
||||
(template_param0)(template_param1)...,
|
||||
(struct_name) (specialization_param0)(specialization_param1)...,
|
||||
(member_type0, member_name0, key_type0)
|
||||
(member_type1, member_name1, key_type1)
|
||||
([member_type0,] member_name0, key_type0)
|
||||
([member_type1,] member_name1, key_type1)
|
||||
...
|
||||
)
|
||||
|
||||
@ -435,10 +550,13 @@ the template type parameters used.
|
||||
The sequence `(specialization_param0)(specialization_param1)...`
|
||||
declares the template parameters of the actual specialization of `struct_name`
|
||||
that is adapted as a fusion sequence.
|
||||
The sequence of `(member_typeN, member_nameN, key_typeN)`
|
||||
triples declares the type, name and key type of each of the struct members
|
||||
The sequence of `([member_typeN,] member_nameN, key_typeN)`
|
||||
tuples declares the type, name and key type of each of the struct members
|
||||
that are part of the sequence.
|
||||
|
||||
When member_typeN is omitted or set to BOOST_FUSION_ADAPT_AUTO, the type is
|
||||
infered with Boost.TypeOf.
|
||||
|
||||
The macro should be used at global scope, and `struct_name` should be the fully
|
||||
namespace qualified name of the struct to be adapted.
|
||||
|
||||
@ -467,6 +585,13 @@ namespace qualified name of the struct to be adapted.
|
||||
// Any instantiated demo::employee is now a Fusion sequence.
|
||||
// It is also an associative sequence with
|
||||
// keys keys::name and keys::age present.
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
|
||||
(Name)(Age),
|
||||
(demo::employee) (Name)(Age),
|
||||
(name, keys::name)
|
||||
(age, keys::age))
|
||||
|
||||
// Without BOOST_PP_VARIADICS support :
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
|
||||
(Name)(Age),
|
||||
(demo::employee) (Name)(Age),
|
||||
@ -486,8 +611,8 @@ __associative_sequence__. The given struct is adapted using the given name.
|
||||
[heading Synopsis]
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
|
||||
struct_name, adapted_name,
|
||||
(member_type0, member_name0, key_type0)
|
||||
(member_type1, member_name1, key_type1)
|
||||
([member_type0,] member_name0, key_type0)
|
||||
([member_type1,] member_name1, key_type1)
|
||||
...
|
||||
)
|
||||
|
||||
@ -495,8 +620,8 @@ __associative_sequence__. The given struct is adapted using the given name.
|
||||
struct_name,
|
||||
(namespace0)(namespace1)...,
|
||||
adapted_name,
|
||||
(member_type0, member_name0, key_type0)
|
||||
(member_type1, member_name1, key_type1)
|
||||
([member_type0,] member_name0, key_type0)
|
||||
([member_type1,] member_name1, key_type1)
|
||||
...
|
||||
)
|
||||
|
||||
@ -516,6 +641,9 @@ The sequence of `(member_typeN, member_nameN, key_typeN)`
|
||||
triples declares the type, name and key type of each of the struct members
|
||||
that are part of the sequence.
|
||||
|
||||
When member_typeN is omitted or set to BOOST_FUSION_ADAPT_AUTO, the type is
|
||||
infered with Boost.TypeOf.
|
||||
|
||||
The macros should be used at global scope, and `struct_name` should be the fully
|
||||
namespace qualified name of the struct to be converted.
|
||||
|
||||
@ -544,8 +672,14 @@ namespace qualified name of the struct to be converted.
|
||||
// referring to demo::employee
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
|
||||
demo::employee, adapted_employee,
|
||||
(std::string, name, keys::name)
|
||||
(int, age, keys::age))
|
||||
(name, keys::name)
|
||||
(age, keys::age))
|
||||
|
||||
// Without BOOST_PP_VARIADICS support :
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
|
||||
demo::employee, adapted_employee,
|
||||
(BOOST_FUSION_ADAPT_AUTO, name, keys::name)
|
||||
(BOOST_FUSION_ADAPT_AUTO, age, keys::age))
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -559,8 +693,8 @@ __random_access_sequence__.
|
||||
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
type_name,
|
||||
(attribute_type0, attribute_const_type0, get_expr0, set_expr0)
|
||||
(attribute_type1, attribute_const_type1, get_expr1, set_expr1)
|
||||
([attribute_type0, attribute_const_type0,] get_expr0, set_expr0)
|
||||
([attribute_type1, attribute_const_type1,] get_expr1, set_expr1)
|
||||
...
|
||||
)
|
||||
|
||||
@ -569,7 +703,7 @@ __random_access_sequence__.
|
||||
The above macro generates the necessary code to adapt `type_name`
|
||||
as a model of __random_access_sequence__.
|
||||
The sequence of
|
||||
[^(attribute_type['N], attribute_const_type['N], get_expr['N], set_expr['N])]
|
||||
[^([attribute_type['N], attribute_const_type['N],] get_expr['N], set_expr['N])]
|
||||
quadruples declares the types, const types, get-expressions and set-expressions
|
||||
of the elements that are part of the adapted fusion sequence.
|
||||
[^get_expr['N]] is the expression that is invoked to get the ['N]th element
|
||||
@ -577,7 +711,9 @@ of an instance of `type_name`. This expression may access a variable named
|
||||
`obj` of type `type_name&` or `type_name const&` which represents the underlying
|
||||
instance of `type_name`.
|
||||
[^attribute_type['N]] and [^attribute_const_type['N]] may specify the types
|
||||
that [^get_expr['N]] denotes to.
|
||||
that [^get_expr['N]] denotes to, when omitted the type is deduced from
|
||||
[get_expr['N]] return type via BOOST_TYPEOF. On compiler missing support for
|
||||
variadic macros BOOST_FUSION_ADAPT_AUTO can be used to avoid repeating the type.
|
||||
[^set_expr['N]] is the expression that is invoked to set the ['N]th element
|
||||
of an instance of `type_name`. This expression may access variables named
|
||||
`obj` of type `type_name&`, which represent the corresponding instance of
|
||||
@ -635,8 +771,8 @@ namespace qualified name of the class type to be adapted.
|
||||
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
demo::employee,
|
||||
(std::string const&, std::string const&, obj.get_name(), obj.set_name(val))
|
||||
(int, int, obj.get_age(), obj.set_age(val)))
|
||||
(obj.get_name(), obj.set_name(val))
|
||||
(obj.get_age(), obj.set_age(val)))
|
||||
|
||||
demo::employee e;
|
||||
front(e)="Edward Norton";
|
||||
@ -661,8 +797,8 @@ __random_access_sequence__.
|
||||
BOOST_FUSION_ADAPT_TPL_ADT(
|
||||
(template_param0)(template_param1)...,
|
||||
(type_name) (specialization_param0)(specialization_param1)...,
|
||||
(attribute_type0, attribute_const_type0, get_expr0, set_expr0)
|
||||
(attribute_type1, attribute_const_type1, get_expr1, set_expr1)
|
||||
([attribute_type0, attribute_const_type0,] get_expr0, set_expr0)
|
||||
([attribute_type1, attribute_const_type1,] get_expr1, set_expr1)
|
||||
...
|
||||
)
|
||||
|
||||
@ -685,7 +821,9 @@ of an instance of `type_name`. This expression may access a variable named
|
||||
`obj` of type `type_name&` or `type_name const&` which represents the underlying
|
||||
instance of `type_name`.
|
||||
[^attribute_type['N]] and [^attribute_const_type['N]] may specify the types
|
||||
that [^get_expr['N]] denotes to.
|
||||
that [^get_expr['N]] denotes to, when omitted the type is deduced from
|
||||
[get_expr['N]] return type via BOOST_TYPEOF. On compiler missing support for
|
||||
variadic macros BOOST_FUSION_ADAPT_AUTO can be used to avoid repeating the type.
|
||||
[^set_expr['N]] is the expression that is invoked to set the ['N]th element
|
||||
of an instance of `type_name`. This expression may access variables named
|
||||
`obj` of type `type_name&`, which represent the corresponding instance of
|
||||
@ -770,8 +908,8 @@ __random_access_sequence__ and __associative_sequence__.
|
||||
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT(
|
||||
type_name,
|
||||
(attribute_type0, attribute_const_type0, get_expr0, set_expr0, key_type0)
|
||||
(attribute_type1, attribute_const_type1, get_expr1, set_expr1, key_type1)
|
||||
([attribute_type0, attribute_const_type0,] get_expr0, set_expr0, key_type0)
|
||||
([attribute_type1, attribute_const_type1,] get_expr1, set_expr1, key_type1)
|
||||
...
|
||||
)
|
||||
|
||||
@ -788,7 +926,9 @@ of an instance of `type_name`. This expression may access a variable named
|
||||
`obj` of type `type_name&` or `type_name const&` which represents the underlying
|
||||
instance of `type_name`.
|
||||
[^attribute_type['N]] and [^attribute_const_type['N]] may specify the types
|
||||
that [^get_expr['N]] denotes to.
|
||||
that [^get_expr['N]] denotes to, when omitted the type is deduced from
|
||||
[get_expr['N]] return type via BOOST_TYPEOF. On compiler missing support for
|
||||
variadic macros BOOST_FUSION_ADAPT_AUTO can be used to avoid repeating the type.
|
||||
[^set_expr['N]] is the expression that is invoked to set the ['N]th element
|
||||
of an instance of `type_name`. This expression may access variables named
|
||||
`obj` of type `type_name&`, which represent the corresponding instance of
|
||||
@ -852,8 +992,8 @@ namespace qualified name of the class type to be adapted.
|
||||
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT(
|
||||
demo::employee,
|
||||
(std::string const&, std::string const&, obj.get_name(), obj.set_name(val), keys::name)
|
||||
(int, int, obj.get_age(), obj.set_age(val), keys::age))
|
||||
(obj.get_name(), obj.set_name(val), keys::name)
|
||||
(obj.get_age(), obj.set_age(val), keys::age))
|
||||
|
||||
demo::employee e;
|
||||
at_key<keys::name>(e)="Edward Norton";
|
||||
@ -878,8 +1018,8 @@ __random_access_sequence__ and __associative_sequence__.
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_ADT(
|
||||
(template_param0)(template_param1)...,
|
||||
(type_name) (specialization_param0)(specialization_param1)...,
|
||||
(attribute_type0, attribute_const_type0, get_expr0, set_expr0, key_type0)
|
||||
(attribute_type1, attribute_const_type1, get_expr1, set_expr1, key_type1)
|
||||
([attribute_type0, attribute_const_type0,] get_expr0, set_expr0, key_type0)
|
||||
([attribute_type1, attribute_const_type1,] get_expr1, set_expr1, key_type1)
|
||||
...
|
||||
)
|
||||
|
||||
@ -894,7 +1034,7 @@ The sequence `(specialization_param0)(specialization_param1)...`
|
||||
declares the template parameters of the actual specialization of `type_name`
|
||||
that is adapted as a fusion sequence.
|
||||
The sequence of
|
||||
[^(attribute_type['N], attribute_const_type['N], get_expr['N], set_expr['N], key_type['N])]
|
||||
[^([attribute_type['N], attribute_const_type['N],] get_expr['N], set_expr['N], key_type['N])]
|
||||
5-tuples declares the types, const types, get-expressions, set-expressions and key types
|
||||
of the elements that are part of the adapted fusion sequence.
|
||||
[^get_expr['N]] is the expression that is invoked to get the ['N]th element
|
||||
@ -902,7 +1042,9 @@ of an instance of `type_name`. This expression may access a variable named
|
||||
`obj` of type `type_name&` or `type_name const&` which represents the underlying
|
||||
instance of `type_name`.
|
||||
[^attribute_type['N]] and [^attribute_const_type['N]] may specify the types
|
||||
that [^get_expr['N]] denotes to.
|
||||
that [^get_expr['N]] denotes to, when omitted the type is deduced from
|
||||
[get_expr['N]] return type via BOOST_TYPEOF. On compiler missing support for
|
||||
variadic macros BOOST_FUSION_ADAPT_AUTO can be used to avoid repeating the type.
|
||||
[^set_expr['N]] is the expression that is invoked to set the ['N]th element
|
||||
of an instance of `type_name`. This expression may access variables named
|
||||
`obj` of type `type_name&`, which represent the corresponding instance of
|
||||
|
@ -441,10 +441,10 @@ Linear, exactly `__result_of_size__<Sequence>::value` applications of `F`.
|
||||
[endsect]
|
||||
|
||||
[section for_each]
|
||||
A metafunction returning the result type of applying __for_each__ to a sequence. The
|
||||
return type of __for_each__ is always `void`.
|
||||
|
||||
[heading Description]
|
||||
A metafunction returning the result type of applying __for_each__ to a sequence. The
|
||||
return type of __for_each__ is always `void`.
|
||||
|
||||
[heading Synopsis]
|
||||
template<
|
||||
@ -724,8 +724,10 @@ or `__end__(seq)` if there is no such element.
|
||||
[heading Complexity]
|
||||
Linear. At most `__result_of_size__<Sequence>::value` comparisons.
|
||||
|
||||
#include <boost/fusion/algorithm/query/find_if.hpp>
|
||||
#include <boost/fusion/include/find_if.hpp>
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/algorithm/query/find_if.hpp>
|
||||
#include <boost/fusion/include/find_if.hpp>
|
||||
|
||||
[heading Example]
|
||||
const __vector__<double,int> vec(1.0,2);
|
||||
@ -1361,7 +1363,7 @@ Returns a new sequence, with all the elements of the original sequence, except t
|
||||
typename T,
|
||||
typename Sequence
|
||||
>
|
||||
typename __result_of_remove__<Sequence const, T>::type replace(Sequence const& seq);
|
||||
typename __result_of_remove__<Sequence const, T>::type remove(Sequence const& seq);
|
||||
|
||||
[table Parameters
|
||||
[[Parameter][Requirement][Description]]
|
||||
@ -1830,7 +1832,7 @@ Constant. Returns a view which is lazily evaluated.
|
||||
#include <boost/fusion/include/pop_back.hpp>
|
||||
|
||||
[heading Example]
|
||||
assert(___pop_back__(__make_vector__(1,2,3)) == __make_vector__(1,2));
|
||||
assert(__pop_back__(__make_vector__(1,2,3)) == __make_vector__(1,2));
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -2089,32 +2091,33 @@ Constant.
|
||||
[section transform]
|
||||
|
||||
[heading Description]
|
||||
For a sequence `seq` and function object or function pointer `f`, `transform` returns a new sequence
|
||||
with elements created by applying `f(e)` to each element of `e` of `seq`.
|
||||
Returns the result type of __transform__, given the types of the input sequence and unary __poly_func_obj__.
|
||||
|
||||
[heading Unary version synopsis]
|
||||
template<
|
||||
typename Sequence,
|
||||
typename F
|
||||
>
|
||||
typename __result_of_transform__<Sequence const, F>::type transform(
|
||||
Sequence const& seq, F f);
|
||||
struct transform
|
||||
{
|
||||
typedef __unspecified__ type;
|
||||
};
|
||||
|
||||
[table Parameters
|
||||
[[Parameter][Requirement][Description]]
|
||||
[[`seq`][A model of __forward_sequence__][Operation's argument]]
|
||||
[[`f`][`f(e)` is a valid expression for each element `e` of `seq`. `__boost_result_of_call__<F(E)>::type` is the return type of `f` when called with a value of each element type `E`.][Transformation function]]
|
||||
[[`Sequence`][A model of __forward_sequence__][Operation's argument]]
|
||||
[[`F`][A model of unary __poly_func_obj__][Transformation metafunction]]
|
||||
]
|
||||
|
||||
[heading Expression Semantics]
|
||||
__transform__(seq, f);
|
||||
__result_of_transform__<Sequence, F>::type
|
||||
|
||||
[*Return type]:
|
||||
|
||||
* A model of __forward_sequence__
|
||||
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.
|
||||
|
||||
[*Semantics]: Returns a new sequence, containing the return values of `f(e)` for each element `e` within `seq`.
|
||||
[*Semantics]: Returns a sequence that contains the types of `__result_of__<F(E)>::type` for each element `E` within `Sequence`.
|
||||
|
||||
[heading Binary version synopsis]
|
||||
template<
|
||||
@ -2122,41 +2125,33 @@ with elements created by applying `f(e)` to each element of `e` of `seq`.
|
||||
typename Sequence2,
|
||||
typename F
|
||||
>
|
||||
typename __result_of_transform__<Sequence1 const, Sequence2 const, F>::type transform(
|
||||
Sequence1 const& seq1, Sequence2 const& seq2, F f);
|
||||
struct transform
|
||||
{
|
||||
typedef __unspecified__ type;
|
||||
};
|
||||
|
||||
[table Parameters
|
||||
[[Parameter][Requirement][Description]]
|
||||
[[`seq1`][A model of __forward_sequence__][Operation's argument]]
|
||||
[[`seq2`][A model of __forward_sequence__][Operation's argument]]
|
||||
[[`f`][`f(e1,e2)` is a valid expression for each pair of elements `e1` of `seq1` and `e2` of `seq2`. `__boost_result_of_call__<F(E1,E2)>::type` is the return type of `f` when called with elements of type `E1` and `E2`][Transformation function]]
|
||||
[[`Sequence1`][A model of __forward_sequence__][Operation's argument]]
|
||||
[[`Sequence2`][A model of __forward_sequence__][Operation's argument]]
|
||||
[[`F`][A model of binary __poly_func_obj__][Transformation metafunction]]
|
||||
]
|
||||
|
||||
[heading Expression Semantics]
|
||||
__result_of_transform__<Sequence1, Sequence2, F>::type
|
||||
|
||||
[*Return type]: A model of __forward_sequence__.
|
||||
|
||||
[*Semantics]: Returns a new sequence, containing the return values of `f(e1, e2)` for each pair of elements `e1` and `e2` within `seq1` and `seq2` respectively.
|
||||
[*Semantics]: Returns a sequence, that contains the types of `__result_of__<F(E1, E2)>::type` for each pair of elements `E1` and `E2` within `Sequence1` and `Sequence2` respectively.
|
||||
|
||||
[heading Complexity]
|
||||
Constant. Returns a view which is lazily evaluated.
|
||||
Constant.
|
||||
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
#include <boost/fusion/include/transform.hpp>
|
||||
|
||||
[heading Example]
|
||||
struct triple
|
||||
{
|
||||
typedef int result_type;
|
||||
|
||||
int operator()(int t) const
|
||||
{
|
||||
return t * 3;
|
||||
};
|
||||
};
|
||||
...
|
||||
assert(__transform__(__make_vector__(1,2,3), triple()) == __make_vector__(3,6,9));
|
||||
|
||||
[endsect]
|
||||
|
||||
[section replace]
|
||||
@ -2200,7 +2195,7 @@ Constant.
|
||||
[section replace_if]
|
||||
|
||||
[heading Description]
|
||||
Returns the result type of __replace_if__, given the types of the sequence, __poly_func_obj__ predicate and replacement object.
|
||||
Returns the result type of __replace_if__, given the types of the sequence, unary __mpl_lambda_expression__ predicate and replacement object.
|
||||
|
||||
[heading Synopsis]
|
||||
template<
|
||||
@ -2215,7 +2210,7 @@ Returns the result type of __replace_if__, given the types of the sequence, __po
|
||||
[table Parameters
|
||||
[[Parameter][Requirement][Description]]
|
||||
[[`Sequence`][A model of __forward_sequence__][Operation's argument]]
|
||||
[[`F`][A model of unary __poly_func_obj__][Replacement predicate]]
|
||||
[[`F`][A model of unary __mpl_lambda_expression__][Replacement predicate]]
|
||||
[[`T`][Any type][The type of the replacement object]]
|
||||
]
|
||||
|
||||
@ -2265,7 +2260,7 @@ Returns the result type of __remove__, given the sequence and removal types.
|
||||
* A model of __forward_sequence__.
|
||||
* A model of __associative_sequence__ if `Sequence` implements the __associative_sequence__ model.
|
||||
|
||||
[*Semantics]: Returns a sequence containing the elements of `Sequence` not of type `T`. Equivalent to `__result_of_replace_if__<Sequence, boost::is_same<mpl::_, T> >::type`.
|
||||
[*Semantics]: Returns a sequence containing the elements of `Sequence` not of type `T`. Equivalent to `__result_of_remove_if__<Sequence, boost::is_same<mpl::_, T> >::type`.
|
||||
|
||||
[heading Complexity]
|
||||
Constant.
|
||||
|
@ -191,7 +191,7 @@ defined in __forward_sequence__.
|
||||
[[`__at__<N>(l)`] [The Nth element from the beginning of the sequence; see __at__.]]
|
||||
]
|
||||
|
||||
[blurb __note__ `__at__<N>(l)` is provided for convenience and compatibility
|
||||
[note `__at__<N>(l)` is provided for convenience and compatibility
|
||||
with the original __tuple__ library, despite `cons` being a
|
||||
__forward_sequence__ only (`at` is supposed to be a
|
||||
__random_access_sequence__ requirement). The runtime complexity of __at__ is
|
||||
@ -276,7 +276,7 @@ defined in __forward_sequence__.
|
||||
[[`__at__<N>(l)`] [The Nth element from the beginning of the sequence; see __at__.]]
|
||||
]
|
||||
|
||||
[blurb __note__ `__at__<n>(l)` is provided for convenience and compatibility
|
||||
[note `__at__<n>(l)` is provided for convenience and compatibility
|
||||
with the original __tuple__ library, despite `list` being a
|
||||
__forward_sequence__ only (__at__ is supposed to be a
|
||||
__random_access_sequence__ requirement). The runtime complexity of __at__ is
|
||||
@ -363,7 +363,7 @@ defined in __bidirectional_sequence__.
|
||||
[[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
|
||||
]
|
||||
|
||||
[blurb __note__ `__at__<N>(d)` is provided for convenience, despite
|
||||
[note `__at__<N>(d)` is provided for convenience, despite
|
||||
`deque` being a __bidirectional_sequence__ only (`at` is supposed to be
|
||||
a __random_access_sequence__ requirement). The runtime complexity of
|
||||
__at__ is constant (see __recursive_inline__). `deque` element access
|
||||
@ -406,7 +406,7 @@ the same properties as the __deque__.
|
||||
[[`T`] [Element type] [ ]]
|
||||
]
|
||||
|
||||
[blurb __note__ `Deque` can be a __deque__, a __front_extended_deque__ or a
|
||||
[note `Deque` can be a __deque__, a __front_extended_deque__ or a
|
||||
__back_extended_deque__]
|
||||
|
||||
[heading Model of]
|
||||
@ -430,7 +430,7 @@ not defined in __bidirectional_sequence__.
|
||||
[[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
|
||||
]
|
||||
|
||||
[blurb __note__ See __deque__ for further details.]
|
||||
[note See __deque__ for further details.]
|
||||
|
||||
[heading Example]
|
||||
|
||||
@ -467,7 +467,7 @@ the same properties as the __deque__.
|
||||
[[`T`] [Element type] [ ]]
|
||||
]
|
||||
|
||||
[blurb __note__ `Deque` can be a __deque__, a __back_extended_deque__ or a
|
||||
[note `Deque` can be a __deque__, a __back_extended_deque__ or a
|
||||
__back_extended_deque__]
|
||||
|
||||
[heading Model of]
|
||||
@ -491,7 +491,7 @@ not defined in __bidirectional_sequence__.
|
||||
[[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
|
||||
]
|
||||
|
||||
[blurb __note__ See __deque__ for further details.]
|
||||
[note See __deque__ for further details.]
|
||||
|
||||
[heading Example]
|
||||
|
||||
@ -730,7 +730,7 @@ before including any Fusion header to change the default. Example:
|
||||
|
||||
[heading See also]
|
||||
|
||||
__note_boost_ref__
|
||||
__note_ref_wrappers__
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -778,7 +778,7 @@ __result_of_make_cons__`<Car>::type`
|
||||
|
||||
[heading See also]
|
||||
|
||||
__note_boost_ref__
|
||||
__note_ref_wrappers__
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -828,7 +828,7 @@ default. Example:
|
||||
|
||||
[heading See also]
|
||||
|
||||
__note_boost_ref__
|
||||
__note_ref_wrappers__
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -880,7 +880,7 @@ Fusion header to change the default. Example:
|
||||
|
||||
[heading See also]
|
||||
|
||||
__note_boost_ref__
|
||||
__note_ref_wrappers__
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -932,7 +932,7 @@ default. Example:
|
||||
|
||||
[heading See also]
|
||||
|
||||
__note_boost_ref__
|
||||
__note_ref_wrappers__
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -990,7 +990,7 @@ default. Example:
|
||||
|
||||
[heading See also]
|
||||
|
||||
__note_boost_ref__, __fusion_pair__
|
||||
__note_ref_wrappers__, __fusion_pair__
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -323,7 +323,7 @@ For our __random_access_sequence__ we will also need to implement `size_impl`,
|
||||
In order for `example_struct` to serve as an associative forward sequence,
|
||||
we need to adapt the traversal category of our sequence and our iterator
|
||||
accordingly and enable 3 intrinsic sequence lookup features, __at_key__,
|
||||
__value_at_key__ and __has_key__. We also need to enable 3 iterator lookup
|
||||
__result_of_value_at_key__ and __has_key__. We also need to enable 3 iterator lookup
|
||||
features, __result_of_key_of__, __result_of_value_of_data__ and __deref_data__.
|
||||
|
||||
To implement `at_key_impl` we need to associate the `fields::name` and `fields::age`
|
||||
|
@ -931,11 +931,11 @@ reference. Const qualification is preserved and propagated appropriately
|
||||
the target function object is const - or, in case the target function object
|
||||
is held by value, the adapter is const).
|
||||
|
||||
[blurb __note__ For Microsoft Visual C++ 7.1 (Visual Studio 2003) the detection
|
||||
[note For Microsoft Visual C++ 7.1 (Visual Studio 2003) the detection
|
||||
of the Function Object's const qualification easily causes an internal error.
|
||||
Therefore the adapter is always treated as if it was const. ]
|
||||
|
||||
[blurb __tip__ If the type sequence passed to this template contains
|
||||
[tip If the type sequence passed to this template contains
|
||||
non-reference elements, the element is copied only once - the call operator's
|
||||
signature is optimized automatically to avoid by-value parameters.]
|
||||
|
||||
|
@ -20,11 +20,6 @@
|
||||
]
|
||||
]
|
||||
|
||||
[def __note__ [$images/note.png]]
|
||||
[def __alert__ [$images/alert.png]]
|
||||
[def __tip__ [$images/tip.png]]
|
||||
[def __caution__ [$images/caution.png]]
|
||||
|
||||
[def __spirit__ [@http://spirit.sourceforge.net Spirit]]
|
||||
[def __phoenix__ [@http://www.boost.org/libs/phoenix/index.html Phoenix]]
|
||||
[def __mpl__ [@http://www.boost.org/libs/mpl/index.html MPL]]
|
||||
@ -55,6 +50,7 @@
|
||||
[def __boost_func_factory__ [@http://www.boost.org/libs/functional/factory/doc/html/index.html Boost.Functional/Factory]]
|
||||
[def __boost_func_hash__ [@http://www.boost.org/doc/html/hash.html Boost.Functional/Hash]]
|
||||
[def __std_pair_doc__ [@http://www.sgi.com/tech/stl/pair.html `std::pair`]]
|
||||
[def __std_tuple_doc__ [@http://en.cppreference.com/w/cpp/utility/tuple `std::tuple`]]
|
||||
[def __std_plus_doc__ [@http://www.sgi.com/tech/stl/plus.html `std::plus`]]
|
||||
[def __std_minus_doc__ [@http://www.sgi.com/tech/stl/minus.html `std::minus`]]
|
||||
|
||||
@ -321,17 +317,17 @@
|
||||
[def __result_of_invoke__ [link fusion.functional.invocation.metafunctions.invoke `result_of::invoke`]]
|
||||
[def __result_of_invoke_procedure__ [link fusion.functional.invocation.metafunctions.invoke_proc `result_of::invoke_procedure`]]
|
||||
[def __result_of_invoke_function_object__ [link fusion.functional.invocation.metafunctions.invoke_fobj `result_of::invoke_function_object`]]
|
||||
[def __result_of_make_fused__ [link fusion.functional.generation.metafunctions.mk_fused `make_fused`]]
|
||||
[def __result_of_make_fused_procedure__ [link fusion.functional.generation.metafunctions.mk_fused_proc `make_fused_procedure`]]
|
||||
[def __result_of_make_fused_function_object__ [link fusion.functional.generation.metafunctions.mk_fused_fobj `make_fused_function_object`]]
|
||||
[def __result_of_make_unfused__ [link fusion.functional.generation.metafunctions.mk_unfused `make_unfused`]]
|
||||
[def __result_of_make_fused__ [link fusion.functional.generation.metafunctions.mk_fused `result_of::make_fused`]]
|
||||
[def __result_of_make_fused_procedure__ [link fusion.functional.generation.metafunctions.mk_fused_proc `result_of::make_fused_procedure`]]
|
||||
[def __result_of_make_fused_function_object__ [link fusion.functional.generation.metafunctions.mk_fused_fobj `result_of::make_fused_function_object`]]
|
||||
[def __result_of_make_unfused__ [link fusion.functional.generation.metafunctions.mk_unfused `result_of::make_unfused`]]
|
||||
|
||||
[def __recursive_inline__ [link fusion.notes.recursive_inlined_functions Recursive Inlined Functions]]
|
||||
[def __overloaded_functions__ [link fusion.notes.overloaded_functions Overloaded Functions]]
|
||||
[def __tag_dispatching__ [link fusion.notes.tag_dispatching /tag dispatching/]]
|
||||
[def __element_conversion__ [link fusion.notes.element_conversion /element conversion/]]
|
||||
[def __see_element_conversion__ [link fusion.notes.element_conversion /see element conversion/]]
|
||||
[def __note_boost_ref__ [link fusion.notes.boost__ref `boost::ref`]]
|
||||
[def __note_ref_wrappers__ [link fusion.notes.reference_wrappers `Reference Wrappers`]]
|
||||
|
||||
[def __quick_start__ [link fusion.quick_start Quick Start]]
|
||||
[def __organization__ [link fusion.organization Organization]]
|
||||
|
Before Width: | Height: | Size: 603 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 722 B |
Before Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 334 B |
Before Width: | Height: | Size: 867 B |
Before Width: | Height: | Size: 640 B |
Before Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 1.2 KiB |
@ -167,6 +167,7 @@
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/adapted/array.html">Array</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/std__pair.html">std::pair</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/std__tuple.html">std::tuple</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/mpl_sequence.html">mpl sequence</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/boost__array.html">boost::array</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/boost__tuple.html">boost::tuple</a></span></dt>
|
||||
|
@ -67,8 +67,7 @@ the following expressions are valid:
|
||||
]
|
||||
|
||||
[heading Expression Semantics]
|
||||
[
|
||||
table
|
||||
[table
|
||||
[[Expression] [Semantics]]
|
||||
[[`__next__(i)`] [An iterator to the element following `i`]]
|
||||
[[`i == j`] [Iterator equality comparison]]
|
||||
@ -418,15 +417,15 @@ Moves an iterator by a specified distance.
|
||||
|
||||
[heading Synopsis]
|
||||
template<
|
||||
typename I,
|
||||
typename M
|
||||
typename M,
|
||||
typename I
|
||||
>
|
||||
typename __result_of_advance__<I, M>::type advance(I const& i);
|
||||
|
||||
[table Parameters
|
||||
[[Parameter] [Requirement] [Description]]
|
||||
[[`i`] [Model of __forward_iterator__] [Iterator to move relative to]]
|
||||
[[`N`] [An __mpl_integral_constant__] [Number of positions to move]]
|
||||
[[`M`] [An __mpl_integral_constant__] [Number of positions to move]]
|
||||
]
|
||||
|
||||
[heading Expression Semantics]
|
||||
@ -455,8 +454,8 @@ Moves an iterator by a specified distance.
|
||||
|
||||
[heading Synopsis]
|
||||
template<
|
||||
typename I,
|
||||
int N
|
||||
int N,
|
||||
typename I
|
||||
>
|
||||
typename __result_of_advance_c__<I, N>::type advance_c(I const& i);
|
||||
|
||||
@ -537,7 +536,7 @@ Dereferences an iterator.
|
||||
template<
|
||||
typename I
|
||||
>
|
||||
typename __result_of_deref__<I>::type operator*(__unspecified__<I> const& i);
|
||||
typename __result_of_deref__<I>::type operator*(I const& i);
|
||||
|
||||
[table Parameters
|
||||
[[Parameter] [Requirement] [Description]]
|
||||
|
@ -100,7 +100,7 @@ Array arguments are deduced to reference to const types. For example
|
||||
[footnote Note that the type of a string literal is an array of const
|
||||
characters, not `const char*`. To get __make_list__ to create a __list__
|
||||
with an element of a non-const array type one must use the `ref` wrapper
|
||||
(see __note_boost_ref__).]:
|
||||
(see __note_ref_wrappers__).]:
|
||||
|
||||
__make_list__("Donald", "Daisy")
|
||||
|
||||
@ -121,7 +121,7 @@ creates a __list__ of type
|
||||
|
||||
__list__<void (*)(int)>
|
||||
|
||||
[heading boost::ref]
|
||||
[heading Reference Wrappers]
|
||||
|
||||
Fusion's generation functions (e.g. __make_list__) by default stores the
|
||||
element types as plain non-reference types. Example:
|
||||
@ -151,6 +151,8 @@ For example:
|
||||
|
||||
See __boost_ref__ for details.
|
||||
|
||||
Since C++11, the standard reference wrappers (`std::ref` and `std::cref`) work as well.
|
||||
|
||||
[heading adt_attribute_proxy]
|
||||
|
||||
To adapt arbitrary data types that do not allow direct access to their members,
|
||||
|
@ -36,20 +36,26 @@ link against.
|
||||
|
||||
* tuple
|
||||
* algorithm
|
||||
* auxiliary
|
||||
* iteration
|
||||
* query
|
||||
* transformation
|
||||
* adapted
|
||||
* adt
|
||||
* array
|
||||
* mpl
|
||||
* boost::array
|
||||
* boost::tuple
|
||||
* mpl
|
||||
* std_pair
|
||||
* std_tuple
|
||||
* struct
|
||||
* variant
|
||||
* view
|
||||
* filter_view
|
||||
* flatten_view
|
||||
* iterator_range
|
||||
* joint_view
|
||||
* nview
|
||||
* repetitive_view
|
||||
* reverse_view
|
||||
* single_view
|
||||
* transform_view
|
||||
@ -63,6 +69,9 @@ link against.
|
||||
* generation
|
||||
* mpl
|
||||
* functional
|
||||
* adapter
|
||||
* generation
|
||||
* invocation
|
||||
* sequence
|
||||
* comparison
|
||||
* intrinsic
|
||||
|
@ -49,16 +49,11 @@ and traversal routines. It was an instant /AHA!/ moment.
|
||||
Some icons are used to mark certain topics indicative of their relevance.
|
||||
These icons precede some text to indicate:
|
||||
|
||||
[table Icons
|
||||
[[Icon] [Name] [Meaning]]
|
||||
[[__note__] [Note] [Information provided is auxiliary but will
|
||||
give the reader a deeper insight into a specific
|
||||
topic. May be skipped.]]
|
||||
[[__alert__] [Alert] [Information provided is of utmost importance.]]
|
||||
[[__caution__] [Caution] [A mild warning.]]
|
||||
[[__tip__] [Tip] [A potentially useful and helpful piece of
|
||||
information.]]
|
||||
]
|
||||
[note Information provided is auxiliary but will give the reader a deeper
|
||||
insight into a specific topic. May be skipped.]
|
||||
[important Information provided is of utmost importance.]
|
||||
[caution A mild warning.]
|
||||
[tip A potentially useful and helpful piece of information.]
|
||||
|
||||
This documentation is automatically generated by Boost QuickBook documentation
|
||||
tool. QuickBook can be found in the __boost_tools__.
|
||||
|
@ -249,15 +249,18 @@ any Random Access Sequence the following must be met:
|
||||
[[Expression] [Compile Time Complexity]]
|
||||
[[`__result_of_begin__<S>::type`] [Amortized constant time]]
|
||||
[[`__result_of_end__<S>::type`] [Amortized constant time]]
|
||||
[[`__result_of_at__<S, N>::type`] [Amortized constant time]]
|
||||
[[`__result_of_value_at__<S, N>::type`] [Amortized constant time]]
|
||||
[[`__result_of_at__<S, M>::type`] [Amortized constant time]]
|
||||
[[`__result_of_at_c__<S, N>::type`] [Amortized constant time]]
|
||||
[[`__result_of_value_at__<S, M>::type`] [Amortized constant time]]
|
||||
[[`__result_of_value_at_c__<S, N>::type`] [Amortized constant time]]
|
||||
]
|
||||
|
||||
[blurb __note__ `__result_of_at__<S, N>` returns the actual type returned by
|
||||
`__at__<N>(s)`. In most cases, this is a reference. Hence, there is no way to
|
||||
know the exact element type using `__result_of_at__<S, N>`.The element at `N`
|
||||
[note `__result_of_at__<S, M>` returns the actual type returned by
|
||||
`__at__<M>(s)`. In most cases, this is a reference. Hence, there is no way to
|
||||
know the exact element type using `__result_of_at__<S, M>`.The element at `M`
|
||||
may actually be a reference to begin with. For this purpose, you can use
|
||||
`__result_of_value_at__<S, N>`.]
|
||||
`__result_of_value_at__<S, M>` (Note that, `__result_of_value_at_c__<S, N>`
|
||||
is a counterpart of `__result_of_at_c__<S, N>` as well).]
|
||||
|
||||
[heading Expression Semantics]
|
||||
|
||||
@ -327,11 +330,11 @@ For any Associative Sequence the following expressions must be valid:
|
||||
[[`__result_of_value_at_key__<S, K>::type`] [Amortized constant time]]
|
||||
]
|
||||
|
||||
[blurb __note__ `__result_of_at_key__<S, K>` returns the actual type returned
|
||||
[note `__result_of_at_key__<S, K>` returns the actual type returned
|
||||
by `__at_key__<K>(s)`. In most cases, this is a reference. Hence, there is no
|
||||
way to know the exact element type using `__result_of_at_key__<S, K>`.The
|
||||
element at `K` may actually be a reference to begin with. For this purpose,
|
||||
you can use `__result_of_value_at_key__<S, N>`.]
|
||||
you can use `__result_of_value_at_key__<S, K>`.]
|
||||
|
||||
[heading Expression Semantics]
|
||||
|
||||
@ -1323,7 +1326,7 @@ Returns the result type of __has_key__.
|
||||
[heading Description]
|
||||
|
||||
Returns the result type of __at_key__[footnote __result_of_at_key__
|
||||
reflects the actual return type of the function __at_key__. __sequence__s
|
||||
reflects the actual return type of the function __at_key__. __sequence__(s)
|
||||
typically return references to its elements via the __at_key__ function. If
|
||||
you want to get the actual element type, use __result_of_value_at_key__].
|
||||
|
||||
@ -1445,7 +1448,7 @@ operators for free.
|
||||
|
||||
The I/O operators: `<<` and `>>` work generically on all Fusion
|
||||
sequences. The I/O operators are overloaded in namespace `boost::fusion`
|
||||
[footnote __sequences__ and __views__ residing in different namespaces
|
||||
[footnote __sequence__(s) and __views__ residing in different namespaces
|
||||
will have to either provide their own I/O operators (possibly forwarding
|
||||
to fusion's I/O operators) or hoist fusion's I/O operators (using
|
||||
declaration), in their own namespaces for proper argument dependent
|
||||
@ -1637,7 +1640,7 @@ compile time error.
|
||||
[*Semantics]:
|
||||
|
||||
For each element, `e1`, in sequence `a`, and for each element, `e2`, in
|
||||
sequence `b`, `e1 == e2` returns true. For any 2 zero length __sequence__s,
|
||||
sequence `b`, `e1 == e2` returns true. For any 2 zero length __sequence__(s),
|
||||
e and f, e == f returns true.
|
||||
|
||||
[heading Header]
|
||||
|
@ -254,7 +254,8 @@ Metafunction to apply __element_conversion__ to the full argument type.
|
||||
|
||||
It removes references to `const`, references to array types are kept, even
|
||||
if the array is `const`. Reference wrappers are removed (see
|
||||
__note_boost_ref__).
|
||||
__note_ref_wrappers__)[footnote Since C++11, the standard reference wrappers
|
||||
are also removed.].
|
||||
|
||||
[heading Header]
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2009-2010 Hartmut Kaiser
|
||||
Copyright (c) 2010-2011 Christopher Schmidt
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,6 +14,9 @@
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/comparison/equal.hpp>
|
||||
#include <boost/preprocessor/comparison/less.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
@ -22,6 +26,7 @@
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/proxy_type.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
|
||||
@ -32,17 +37,21 @@
|
||||
#include <boost/fusion/adapted/struct/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/adapted/adt/detail/extension.hpp>
|
||||
#include <boost/fusion/adapted/adt/detail/adapt_base.hpp>
|
||||
#include <boost/fusion/adapted/adt/detail/adapt_base_attr_filler.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_FILLER_0(A, B, C, D)\
|
||||
((A, B, C, D)) BOOST_FUSION_ADAPT_ADT_FILLER_1
|
||||
#define BOOST_FUSION_ADAPT_ADT_FILLER_1(A, B, C, D)\
|
||||
((A, B, C, D)) BOOST_FUSION_ADAPT_ADT_FILLER_0
|
||||
#define BOOST_FUSION_ADAPT_ADT_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_ADT_FILLER_1_END
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_C(TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE) \
|
||||
#define BOOST_FUSION_ADAPT_ADT_C( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, IS_VIEW, I, ATTRIBUTE) \
|
||||
BOOST_FUSION_ADAPT_ADT_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE, 4)
|
||||
TEMPLATE_PARAMS_SEQ, \
|
||||
NAME_SEQ, \
|
||||
I, \
|
||||
BOOST_PP_IF(IS_VIEW, BOOST_FUSION_PROXY_PREFIX, BOOST_PP_EMPTY), \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR(ATTRIBUTE), \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), \
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_LESS( \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), 4) \
|
||||
, 1, 0))
|
||||
|
||||
#define BOOST_FUSION_ADAPT_TPL_ADT(TEMPLATE_PARAMS_SEQ, NAME_SEQ , ATTRIBUTES) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
|
@ -2,6 +2,7 @@
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2007 Dan Marsden
|
||||
Copyright (c) 2010-2011 Christopher Schmidt
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -22,6 +23,7 @@
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/proxy_type.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/category_of_impl.hpp>
|
||||
@ -35,25 +37,29 @@
|
||||
#include <boost/fusion/adapted/struct/detail/value_of_data_impl.hpp>
|
||||
#include <boost/fusion/adapted/adt/detail/extension.hpp>
|
||||
#include <boost/fusion/adapted/adt/detail/adapt_base.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(A, B, C, D, E)\
|
||||
((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1(A, B, C, D, E)\
|
||||
((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1_END
|
||||
#include <boost/fusion/adapted/adt/detail/adapt_base_assoc_attr_filler.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_C( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE) \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, IS_VIEW, I, ATTRIBUTE) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_ADT_C_BASE(TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,5) \
|
||||
BOOST_FUSION_ADAPT_ADT_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ, \
|
||||
NAME_SEQ, \
|
||||
I, \
|
||||
BOOST_PP_IF(IS_VIEW, BOOST_FUSION_PROXY_PREFIX, BOOST_PP_EMPTY), \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR(ATTRIBUTE), \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), \
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_LESS( \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), 5) \
|
||||
, 1, 0)) \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
> \
|
||||
struct struct_assoc_key<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(5, 4, ATTRIBUTE) type; \
|
||||
typedef BOOST_FUSION_ADAPT_ASSOC_ADT_WRAPPEDATTR_GET_KEY(ATTRIBUTE) type;\
|
||||
};
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_TPL_ADT( \
|
||||
|
@ -11,17 +11,18 @@
|
||||
#define BOOST_FUSION_ADAPTED_ADT_DETAIL_ADAPT_BASE_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_auto.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_is_tpl.hpp>
|
||||
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/seq/seq.hpp>
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#if defined(BOOST_GCC)
|
||||
#define BOOST_FUSION_ADT_CONSTEXPR BOOST_CXX14_CONSTEXPR
|
||||
#else
|
||||
#define BOOST_FUSION_ADT_CONSTEXPR BOOST_CONSTEXPR
|
||||
#endif
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_GET_IDENTITY_TEMPLATE_IMPL(TEMPLATE_PARAMS_SEQ) \
|
||||
typename detail::get_identity< \
|
||||
@ -34,8 +35,72 @@
|
||||
\
|
||||
boost::remove_const<boost::remove_reference<lvalue>::type>::type
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_ATTRIBUTE_GETEXPR(ATTRIBUTE, \
|
||||
ATTRIBUTE_TUPEL_SIZE, DEDUCE_TYPE) \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, \
|
||||
BOOST_PP_IF(DEDUCE_TYPE, 0, 2), ATTRIBUTE)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_ATTRIBUTE_SETEXPR(ATTRIBUTE, \
|
||||
ATTRIBUTE_TUPEL_SIZE, DEDUCE_TYPE) \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, \
|
||||
BOOST_PP_IF(DEDUCE_TYPE, 1, 3), ATTRIBUTE)
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# define BOOST_FUSION_DEDUCED_ATTR_TYPE(NAME_SEQ, ATTRIBUTE, \
|
||||
ATTRIBUTE_TUPEL_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS( \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
struct deduced_attr_type { \
|
||||
static const BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj; \
|
||||
typedef \
|
||||
BOOST_PP_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ),typename,) \
|
||||
BOOST_TYPEOF( PREFIX() BOOST_FUSION_ADAPT_ADT_ATTRIBUTE_GETEXPR( \
|
||||
ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE, 1)) type; \
|
||||
};
|
||||
|
||||
#else
|
||||
# define BOOST_FUSION_DEDUCED_ATTR_TYPE(NAME_SEQ, ATTRIBUTE, \
|
||||
ATTRIBUTE_TUPEL_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
||||
struct deduced_attr_type { \
|
||||
static const BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj; \
|
||||
typedef BOOST_TYPEOF( PREFIX() BOOST_FUSION_ADAPT_ADT_ATTRIBUTE_GETEXPR( \
|
||||
ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE, 1)) type; \
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_FUSION_ADT_ATTRIBUTE_TYPEOF( \
|
||||
NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
BOOST_FUSION_DEDUCED_ATTR_TYPE( \
|
||||
NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
typedef \
|
||||
BOOST_PP_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ),typename,) \
|
||||
boost::remove_const< \
|
||||
BOOST_PP_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ),typename,) \
|
||||
deduced_attr_type::type \
|
||||
>::type type; \
|
||||
\
|
||||
typedef \
|
||||
BOOST_PP_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ),typename,) \
|
||||
boost::add_const< \
|
||||
BOOST_PP_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ),typename,) \
|
||||
deduced_attr_type::type \
|
||||
>::type const_type;
|
||||
|
||||
#define BOOST_FUSION_ADT_ATTRIBUTE_GIVENTYPE( \
|
||||
NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) type; \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) const_type;
|
||||
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,PREFIX, \
|
||||
ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE, DEDUCE_TYPE) \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
@ -45,6 +110,16 @@
|
||||
, I \
|
||||
> \
|
||||
{ \
|
||||
\
|
||||
BOOST_PP_IF(DEDUCE_TYPE, \
|
||||
BOOST_FUSION_ADT_ATTRIBUTE_TYPEOF, \
|
||||
BOOST_FUSION_ADT_ATTRIBUTE_GIVENTYPE)( \
|
||||
NAME_SEQ, \
|
||||
ATTRIBUTE, \
|
||||
ATTRIBUTE_TUPEL_SIZE, \
|
||||
PREFIX, \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
template<class Val> \
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
|
||||
static void \
|
||||
@ -52,23 +127,26 @@
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj, \
|
||||
Val const& val) \
|
||||
{ \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 3, ATTRIBUTE); \
|
||||
PREFIX() BOOST_FUSION_ADAPT_ADT_ATTRIBUTE_SETEXPR(ATTRIBUTE, \
|
||||
ATTRIBUTE_TUPEL_SIZE, DEDUCE_TYPE); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_ADT_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
|
||||
static BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
static type \
|
||||
boost_fusion_adapt_adt_impl_get( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj) \
|
||||
{ \
|
||||
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
|
||||
return PREFIX() BOOST_FUSION_ADAPT_ADT_ATTRIBUTE_GETEXPR(ATTRIBUTE, \
|
||||
ATTRIBUTE_TUPEL_SIZE, DEDUCE_TYPE); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_ADT_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
|
||||
static BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
static const_type \
|
||||
boost_fusion_adapt_adt_impl_get( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj) \
|
||||
{ \
|
||||
return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \
|
||||
return PREFIX() BOOST_FUSION_ADAPT_ADT_ATTRIBUTE_GETEXPR(ATTRIBUTE, \
|
||||
ATTRIBUTE_TUPEL_SIZE, DEDUCE_TYPE); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
@ -81,7 +159,12 @@
|
||||
, true \
|
||||
> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) type; \
|
||||
typedef \
|
||||
BOOST_PP_IF(BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ), typename, ) \
|
||||
access::adt_attribute_access< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
|
||||
, I \
|
||||
>::const_type type; \
|
||||
\
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
|
||||
explicit \
|
||||
@ -90,7 +173,7 @@
|
||||
: obj(&o) \
|
||||
{} \
|
||||
\
|
||||
BOOST_FUSION_ADT_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
type get() const \
|
||||
{ \
|
||||
return access::adt_attribute_access< \
|
||||
@ -99,7 +182,7 @@
|
||||
>::boost_fusion_adapt_adt_impl_get(*obj); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_ADT_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
operator type() const \
|
||||
{ \
|
||||
return get(); \
|
||||
@ -117,7 +200,12 @@
|
||||
, false \
|
||||
> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) type; \
|
||||
typedef \
|
||||
BOOST_PP_IF(BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ), typename, ) \
|
||||
access::adt_attribute_access< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
|
||||
, I \
|
||||
>::type type; \
|
||||
\
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
|
||||
explicit \
|
||||
@ -138,7 +226,7 @@
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_ADT_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
type get() const \
|
||||
{ \
|
||||
return access::adt_attribute_access< \
|
||||
@ -147,7 +235,7 @@
|
||||
>::boost_fusion_adapt_adt_impl_get(*obj); \
|
||||
} \
|
||||
\
|
||||
BOOST_FUSION_ADT_CONSTEXPR BOOST_FUSION_GPU_ENABLED \
|
||||
BOOST_FUSION_GPU_ENABLED \
|
||||
operator type() const \
|
||||
{ \
|
||||
return get(); \
|
||||
@ -164,7 +252,13 @@
|
||||
, I \
|
||||
> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) lvalue; \
|
||||
typedef BOOST_PP_IF(BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ), typename, ) \
|
||||
adt_attribute_proxy< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \
|
||||
, I \
|
||||
, false \
|
||||
>::type lvalue; \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS( \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
|
@ -0,0 +1,61 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTER_ADT_DETAIL_ADAPT_BASE_ASSOC_ATTR_FILLER_HPP
|
||||
#define BOOST_FUSION_ADAPTER_ADT_DETAIL_ADAPT_BASE_ASSOC_ATTR_FILLER_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/fusion/adapted/adt/detail/adapt_base_attr_filler.hpp>
|
||||
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/variadic/size.hpp>
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/facilities/is_empty.hpp>
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(...) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(__VA_ARGS__) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1(...) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(__VA_ARGS__) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(...) \
|
||||
((BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__)))
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(A, B, C, D, E) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(A, B, C, D, E) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1(A, B, C, D, E) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(A, B, C, D, E) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_WRAP_ATTR(A, B, C, D, E) \
|
||||
BOOST_PP_IF(BOOST_PP_IS_EMPTY(A), \
|
||||
((3, (C,D,E))), \
|
||||
((5, (A,B,C,D,E))) \
|
||||
)
|
||||
|
||||
#endif // BOOST_PP_VARIADICS
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1_END
|
||||
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_ADT_WRAPPEDATTR_GET_KEY(ATTRIBUTE) \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), \
|
||||
BOOST_PP_SUB(BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE), 1), \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR(ATTRIBUTE))
|
||||
|
||||
#endif
|
@ -0,0 +1,90 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_ADT_DETAIL_ADAPT_BASE_ATTR_FILLER_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ADT_DETAIL_ADAPT_BASE_ATTR_FILLER_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/preprocessor/is_seq.hpp>
|
||||
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/logical/or.hpp>
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/tuple/size.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/facilities/is_empty.hpp>
|
||||
#include <boost/preprocessor/variadic/to_seq.hpp>
|
||||
#include <boost/preprocessor/variadic/to_tuple.hpp>
|
||||
#include <boost/preprocessor/variadic/elem.hpp>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
#include <boost/preprocessor/seq/push_front.hpp>
|
||||
#include <boost/preprocessor/seq/rest_n.hpp>
|
||||
|
||||
#include <boost/preprocessor/tuple/reverse.hpp>
|
||||
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR_SIZE(ATTRIBUTE) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ADT_WRAPPEDATTR(ATTRIBUTE) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
# define BOOST_FUSION_ADAPT_ADT_FILLER_0(...) \
|
||||
BOOST_FUSION_ADAPT_ADT_FILLER(__VA_ARGS__) \
|
||||
BOOST_FUSION_ADAPT_ADT_FILLER_1
|
||||
|
||||
# define BOOST_FUSION_ADAPT_ADT_FILLER_1(...) \
|
||||
BOOST_FUSION_ADAPT_ADT_FILLER(__VA_ARGS__) \
|
||||
BOOST_FUSION_ADAPT_ADT_FILLER_0
|
||||
|
||||
# define BOOST_FUSION_ADAPT_ADT_FILLER_0_END
|
||||
# define BOOST_FUSION_ADAPT_ADT_FILLER_1_END
|
||||
|
||||
# define BOOST_FUSION_ADAPT_ADT_FILLER(...) \
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_OR( \
|
||||
BOOST_PP_IS_EMPTY(BOOST_PP_VARIADIC_ELEM(0, __VA_ARGS__)), \
|
||||
BOOST_PP_IS_EMPTY(BOOST_PP_VARIADIC_ELEM(1, __VA_ARGS__))), \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAP_ATTR( \
|
||||
BOOST_PP_VARIADIC_ELEM(2, __VA_ARGS__), \
|
||||
BOOST_FUSION_WORKAROUND_VARIADIC_EMPTINESS_LAST_ELEM(__VA_ARGS__) \
|
||||
), \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(__VA_ARGS__))
|
||||
|
||||
# define BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(...) \
|
||||
((BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__)))
|
||||
|
||||
# define BOOST_FUSION_WORKAROUND_VARIADIC_EMPTINESS_LAST_ELEM(...) \
|
||||
BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_REST_N( \
|
||||
BOOST_PP_SUB(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), 1), \
|
||||
BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)))
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
# define BOOST_FUSION_ADAPT_ADT_FILLER_0(A, B, C, D) \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(A,B,C,D) \
|
||||
BOOST_FUSION_ADAPT_ADT_FILLER_1
|
||||
|
||||
# define BOOST_FUSION_ADAPT_ADT_FILLER_1(A, B, C, D) \
|
||||
BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(A,B,C,D) \
|
||||
BOOST_FUSION_ADAPT_ADT_FILLER_0
|
||||
|
||||
# define BOOST_FUSION_ADAPT_ADT_FILLER_0_END
|
||||
# define BOOST_FUSION_ADAPT_ADT_FILLER_1_END
|
||||
|
||||
# define BOOST_FUSION_ADAPT_ADT_WRAP_ATTR(A, B, C, D) \
|
||||
BOOST_PP_IF(BOOST_PP_IS_EMPTY(A), \
|
||||
((2, (C,D))), \
|
||||
((4, (A,B,C,D))) \
|
||||
)
|
||||
|
||||
#endif // BOOST_PP_VARIADICS
|
||||
|
||||
#endif
|
@ -109,4 +109,13 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Array, int Pos>
|
||||
struct iterator_traits< ::boost::fusion::array_iterator<Array, Pos> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -207,6 +207,15 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Cons>
|
||||
struct iterator_traits< ::boost::fusion::boost_tuple_iterator<Cons> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -114,6 +114,15 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct iterator_traits< ::boost::fusion::mpl_iterator<Iterator> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -107,6 +107,15 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Tuple, int Index>
|
||||
struct iterator_traits< ::boost::fusion::std_tuple_iterator<Tuple, Index> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <boost/fusion/adapted/struct/detail/extension.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_base_assoc_attr_filler.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
|
||||
@ -35,32 +36,35 @@
|
||||
#include <boost/fusion/adapted/struct/detail/key_of_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/value_of_data_impl.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(X, Y, Z) \
|
||||
((X, Y, Z)) BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1(X, Y, Z) \
|
||||
((X, Y, Z)) BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1_END
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,PREFIX,ATTRIBUTE) \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,IS_VIEW,I,PREFIX,ATTRIBUTE) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, PREFIX, ATTRIBUTE, 3) \
|
||||
TEMPLATE_PARAMS_SEQ, \
|
||||
NAME_SEQ, \
|
||||
IS_VIEW, \
|
||||
I, \
|
||||
PREFIX, \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR(ATTRIBUTE), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR_SIZE(ATTRIBUTE), \
|
||||
BOOST_PP_IF(BOOST_PP_LESS( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR_SIZE(ATTRIBUTE),3), 1, 0)) \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
> \
|
||||
struct struct_assoc_key<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ), I> \
|
||||
{ \
|
||||
typedef BOOST_PP_TUPLE_ELEM(3, 2, ATTRIBUTE) type; \
|
||||
typedef \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_WRAPPEDATTR_GET_KEY(ATTRIBUTE) type; \
|
||||
};
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_C( \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ, I, ATTRIBUTE) \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,IS_VIEW, I, ATTRIBUTE) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,BOOST_PP_EMPTY,ATTRIBUTE)
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,IS_VIEW,I,BOOST_PP_EMPTY,ATTRIBUTE)
|
||||
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, ATTRIBUTES) \
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
Copyright (c) 2009-2011 Christopher Schmidt
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -10,8 +11,12 @@
|
||||
#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/preprocessor/config/config.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/comparison/less.hpp>
|
||||
#include <boost/preprocessor/comparison/equal.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
@ -19,6 +24,7 @@
|
||||
|
||||
#include <boost/fusion/adapted/struct/detail/extension.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_base.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_base_attr_filler.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/at_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/is_sequence_impl.hpp>
|
||||
@ -30,43 +36,88 @@
|
||||
#include <boost/fusion/adapted/struct/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/deref_impl.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_0(X, Y) \
|
||||
((X, Y)) BOOST_FUSION_ADAPT_STRUCT_FILLER_1
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_1(X, Y) \
|
||||
((X, Y)) BOOST_FUSION_ADAPT_STRUCT_FILLER_0
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_1_END
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_C(TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE)\
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_C( \
|
||||
TEMPLATE_PARAMS_SEQ, NAME_SEQ, IS_VIEW, I, ATTRIBUTE) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,BOOST_PP_EMPTY,ATTRIBUTE,2)
|
||||
TEMPLATE_PARAMS_SEQ, \
|
||||
NAME_SEQ, \
|
||||
IS_VIEW, \
|
||||
I, \
|
||||
BOOST_PP_IF(IS_VIEW, BOOST_FUSION_PROXY_PREFIX, BOOST_PP_EMPTY), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR(ATTRIBUTE), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR_SIZE(ATTRIBUTE), \
|
||||
BOOST_PP_IF( \
|
||||
BOOST_PP_LESS( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR_SIZE(ATTRIBUTE), 2) \
|
||||
, 1, 0))
|
||||
|
||||
#define BOOST_FUSION_ADAPT_TPL_STRUCT(TEMPLATE_PARAMS_SEQ,NAME_SEQ, ATTRIBUTES) \
|
||||
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
# define BOOST_FUSION_ADAPT_TPL_STRUCT(TEMPLATE_PARAMS_SEQ,NAME_SEQ, ...) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(1)TEMPLATE_PARAMS_SEQ, \
|
||||
(1)NAME_SEQ, \
|
||||
struct_tag, \
|
||||
0, \
|
||||
((0,0)) BOOST_PP_CAT( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER(__VA_ARGS__), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_C)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT(NAME, ATTRIBUTES) \
|
||||
# define BOOST_FUSION_ADAPT_STRUCT(NAME, ...) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(0), \
|
||||
(0)(NAME), \
|
||||
struct_tag, \
|
||||
0, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER(__VA_ARGS__), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_C)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \
|
||||
# define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ...) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(0), \
|
||||
(0)(NAME), \
|
||||
struct_tag, \
|
||||
1, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER(__VA_ARGS__), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_C)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
# define BOOST_FUSION_ADAPT_TPL_STRUCT( \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ, ATTRIBUTES) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(1)TEMPLATE_PARAMS_SEQ, \
|
||||
(1)NAME_SEQ, \
|
||||
struct_tag, \
|
||||
0, \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_C)
|
||||
|
||||
# define BOOST_FUSION_ADAPT_STRUCT(NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(0), \
|
||||
(0)(NAME), \
|
||||
struct_tag, \
|
||||
0, \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES, \
|
||||
_END), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_C)
|
||||
|
||||
# define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE( \
|
||||
(0), \
|
||||
(0)(NAME), \
|
||||
struct_tag, \
|
||||
1, \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES, \
|
||||
_END), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_C)
|
||||
|
||||
|
||||
#endif // BOOST_PP_VARIADICS
|
||||
|
||||
#endif
|
||||
|
@ -15,26 +15,41 @@
|
||||
#include <boost/fusion/adapted/struct/detail/proxy_type.hpp>
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0(X, Y) \
|
||||
(X, obj.Y) BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_1
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_1(X, Y) \
|
||||
(X, obj.Y) BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_1_END
|
||||
#ifdef BOOST_PP_VARIADICS
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_NAMED_NS( \
|
||||
# define BOOST_FUSION_ADAPT_STRUCT_NAMED_NS( \
|
||||
WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ...) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE_IMPL( \
|
||||
WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_AS_VIEW( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION( \
|
||||
(0)NAMESPACE_SEQ)NAME, \
|
||||
__VA_ARGS__)
|
||||
|
||||
# define BOOST_FUSION_ADAPT_STRUCT_NAMED(WRAPPED_TYPE, NAME, ...) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED_NS( \
|
||||
WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,__VA_ARGS__)
|
||||
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
# define BOOST_FUSION_ADAPT_STRUCT_NAMED_NS( \
|
||||
WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ATTRIBUTES) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE_IMPL( \
|
||||
WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_AS_VIEW( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0 ATTRIBUTES,_END))
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION( \
|
||||
(0)NAMESPACE_SEQ)NAME, \
|
||||
ATTRIBUTES)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \
|
||||
# define BOOST_FUSION_ADAPT_STRUCT_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED_NS( \
|
||||
WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,ATTRIBUTES)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -12,6 +12,13 @@
|
||||
#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/define_struct.hpp>
|
||||
|
||||
#define BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0(X, Y, Z) \
|
||||
((X, Y, Z)) BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_1
|
||||
#define BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_1(X, Y, Z) \
|
||||
((X, Y, Z)) BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0
|
||||
#define BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0_END
|
||||
#define BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_1_END
|
||||
|
||||
#define BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT( \
|
||||
TEMPLATE_PARAMS_SEQ, NAMESPACE_SEQ, NAME, ATTRIBUTES) \
|
||||
\
|
||||
@ -20,7 +27,7 @@
|
||||
(0)NAMESPACE_SEQ, \
|
||||
NAME, \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \
|
||||
3) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT( \
|
||||
@ -34,7 +41,7 @@
|
||||
(0)NAMESPACE_SEQ, \
|
||||
NAME, \
|
||||
BOOST_PP_CAT( \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \
|
||||
BOOST_FUSION_DEFINE_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \
|
||||
3) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT( \
|
||||
|
@ -19,7 +19,7 @@
|
||||
TEMPLATE_PARAMS_SEQ, \
|
||||
(0)NAMESPACE_SEQ, \
|
||||
NAME, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
|
||||
BOOST_PP_CAT(BOOST_FUSION_DEFINE_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
|
||||
2) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT( \
|
||||
@ -32,7 +32,7 @@
|
||||
BOOST_FUSION_DEFINE_STRUCT_IMPL( \
|
||||
(0)NAMESPACE_SEQ, \
|
||||
NAME, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
|
||||
BOOST_PP_CAT(BOOST_FUSION_DEFINE_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
|
||||
2) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT( \
|
||||
|
15
include/boost/fusion/adapted/struct/detail/adapt_auto.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_AUTO_HPP
|
||||
#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_AUTO_HPP
|
||||
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
|
||||
#define BOOST_FUSION_ADAPT_AUTO BOOST_PP_EMPTY()
|
||||
|
||||
#endif
|
@ -2,6 +2,7 @@
|
||||
Copyright (c) 2001-2009 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
Copyright (c) 2009-2011 Christopher Schmidt
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@ -13,6 +14,8 @@
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_auto.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_is_tpl.hpp>
|
||||
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
@ -25,12 +28,16 @@
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/comparison/less.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/tag.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME_TEMPLATE_PARAMS(SEQ) \
|
||||
BOOST_PP_SEQ_HEAD(SEQ)<BOOST_PP_SEQ_ENUM(BOOST_PP_SEQ_TAIL(SEQ))> \
|
||||
BOOST_PP_EMPTY()
|
||||
@ -55,6 +62,49 @@
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS_IMPL, \
|
||||
BOOST_PP_TUPLE_EAT(1))(SEQ)
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# define BOOST_FUSION_ATTRIBUTE_TYPEOF( \
|
||||
NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS( \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
struct deduced_attr_type { \
|
||||
static const BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj; \
|
||||
typedef \
|
||||
BOOST_PP_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), typename, ) \
|
||||
BOOST_TYPEOF( PREFIX() obj.BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, \
|
||||
0, ATTRIBUTE)) \
|
||||
type; \
|
||||
}; \
|
||||
\
|
||||
typedef \
|
||||
BOOST_PP_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), typename, ) \
|
||||
deduced_attr_type::type attribute_type;
|
||||
|
||||
#else
|
||||
# define BOOST_FUSION_ATTRIBUTE_TYPEOF( \
|
||||
NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
struct deduced_attr_type { \
|
||||
static const BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj; \
|
||||
typedef BOOST_TYPEOF( \
|
||||
PREFIX() obj.BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE)) \
|
||||
type; \
|
||||
}; \
|
||||
\
|
||||
typedef \
|
||||
BOOST_PP_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), typename, ) \
|
||||
deduced_attr_type::type attribute_type;
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_FUSION_ATTRIBUTE_GIVENTYPE( \
|
||||
NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPEL_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
||||
typedef \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) attribute_type;
|
||||
|
||||
|
||||
#ifdef BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
|
||||
# define BOOST_FUSION_ADAPT_STRUCT_TAG_OF_SPECIALIZATION( \
|
||||
MODIFIER, TEMPLATE_PARAMS_SEQ, NAME_SEQ, TAG) \
|
||||
@ -83,9 +133,10 @@
|
||||
#endif
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_BASE_UNPACK_AND_CALL(R,DATA,I,ATTRIBUTE) \
|
||||
BOOST_PP_TUPLE_ELEM(3,0,DATA)( \
|
||||
BOOST_PP_TUPLE_ELEM(3,1,DATA), \
|
||||
BOOST_PP_TUPLE_ELEM(3,2,DATA), \
|
||||
BOOST_PP_TUPLE_ELEM(4,0,DATA)( \
|
||||
BOOST_PP_TUPLE_ELEM(4,1,DATA), \
|
||||
BOOST_PP_TUPLE_ELEM(4,2,DATA), \
|
||||
BOOST_PP_TUPLE_ELEM(4,3,DATA), \
|
||||
I, \
|
||||
ATTRIBUTE)
|
||||
|
||||
@ -107,7 +158,9 @@
|
||||
#endif
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_C_BASE( \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,PREFIX,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \
|
||||
TEMPLATE_PARAMS_SEQ,NAME_SEQ,IS_VIEW, \
|
||||
I,PREFIX,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE, \
|
||||
DEDUCE_TYPE) \
|
||||
\
|
||||
template< \
|
||||
BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \
|
||||
@ -117,9 +170,14 @@
|
||||
, I \
|
||||
> \
|
||||
{ \
|
||||
typedef \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) \
|
||||
attribute_type; \
|
||||
BOOST_PP_IF(DEDUCE_TYPE, \
|
||||
BOOST_FUSION_ATTRIBUTE_TYPEOF, BOOST_FUSION_ATTRIBUTE_GIVENTYPE)( \
|
||||
NAME_SEQ, \
|
||||
ATTRIBUTE, \
|
||||
ATTRIBUTE_TUPEL_SIZE, \
|
||||
PREFIX, \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS( \
|
||||
TEMPLATE_PARAMS_SEQ) \
|
||||
\
|
||||
@ -143,7 +201,8 @@
|
||||
call(Seq& seq) \
|
||||
{ \
|
||||
return seq.PREFIX() \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE); \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, \
|
||||
BOOST_PP_IF(DEDUCE_TYPE, 0, 1), ATTRIBUTE); \
|
||||
} \
|
||||
}; \
|
||||
}; \
|
||||
@ -163,7 +222,9 @@
|
||||
call() \
|
||||
{ \
|
||||
return BOOST_PP_STRINGIZE( \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE)); \
|
||||
BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, \
|
||||
BOOST_PP_IF(DEDUCE_TYPE, 0, 1), \
|
||||
ATTRIBUTE)); \
|
||||
} \
|
||||
};
|
||||
|
||||
@ -195,7 +256,7 @@ namespace boost
|
||||
BOOST_PP_TUPLE_EAT(4))( \
|
||||
1, \
|
||||
BOOST_FUSION_ADAPT_STRUCT_BASE_UNPACK_AND_CALL, \
|
||||
(ATTRIBUTES_CALLBACK,TEMPLATE_PARAMS_SEQ,NAME_SEQ), \
|
||||
(ATTRIBUTES_CALLBACK,TEMPLATE_PARAMS_SEQ,NAME_SEQ, IS_VIEW),\
|
||||
BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ)) \
|
||||
\
|
||||
template< \
|
||||
|
@ -0,0 +1,63 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_BASE_ASSOC_ATTR_FILLER_HPP
|
||||
#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_BASE_ASSOC_ATTR_FILLER_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/fusion/adapted/struct/detail/adapt_base_attr_filler.hpp>
|
||||
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/variadic/size.hpp>
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/facilities/is_empty.hpp>
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(...) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_WRAP_ATTR(__VA_ARGS__) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1(...) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_WRAP_ATTR(__VA_ARGS__) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_WRAP_ATTR(...) \
|
||||
((BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__)))
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(X, Y, Z) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_WRAP_ATTR(X, Y, Z) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1(X, Y, Z) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_WRAP_ATTR(X, Y, Z) \
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_WRAP_ATTR(X, Y, Z) \
|
||||
BOOST_PP_IF(BOOST_PP_IS_EMPTY(X), \
|
||||
((2, (Y,Z))), \
|
||||
((3, (X,Y,Z))) \
|
||||
)
|
||||
|
||||
#endif // BOOST_PP_VARIADICS
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_1_END
|
||||
|
||||
|
||||
#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_WRAPPEDATTR_GET_KEY(ATTRIBUTE) \
|
||||
BOOST_PP_TUPLE_ELEM( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR_SIZE(ATTRIBUTE), \
|
||||
BOOST_PP_SUB(BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR_SIZE(ATTRIBUTE), 1), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR(ATTRIBUTE))
|
||||
|
||||
#endif
|
@ -0,0 +1,64 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_BASE_ATTR_FILLER_HPP
|
||||
#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_BASE_ATTR_FILLER_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/preprocessor/is_seq.hpp>
|
||||
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/tuple/size.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/preprocessor/facilities/is_empty.hpp>
|
||||
#include <boost/preprocessor/variadic/to_seq.hpp>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
#include <boost/preprocessor/seq/push_front.hpp>
|
||||
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_0(X, Y) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAP_ATTR(X,Y) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_FILLER_1
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_1(X, Y) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAP_ATTR(X,Y) \
|
||||
BOOST_FUSION_ADAPT_STRUCT_FILLER_0
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_0_END
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_FILLER_1_END
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_WRAP_ATTR(X, Y) \
|
||||
BOOST_PP_IF(BOOST_PP_IS_EMPTY(X), \
|
||||
((1, (Y))), \
|
||||
((2, (X,Y))) \
|
||||
)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR_SIZE(ATTRIBUTE) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE)
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_WRAPPEDATTR(ATTRIBUTE) \
|
||||
BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)
|
||||
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
# define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER_OP(r, unused, elem) \
|
||||
BOOST_PP_IF(BOOST_FUSION_PP_IS_SEQ(elem), \
|
||||
BOOST_PP_CAT( BOOST_FUSION_ADAPT_STRUCT_FILLER_0 elem ,_END), \
|
||||
BOOST_FUSION_ADAPT_STRUCT_WRAP_ATTR(BOOST_FUSION_ADAPT_AUTO, \
|
||||
elem))
|
||||
|
||||
# define BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER(...) \
|
||||
BOOST_PP_SEQ_PUSH_FRONT( \
|
||||
BOOST_PP_SEQ_FOR_EACH( \
|
||||
BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER_OP, \
|
||||
unused, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)), \
|
||||
(0,0))
|
||||
|
||||
#endif // BOOST_PP_VARIADICS
|
||||
|
||||
#endif
|
14
include/boost/fusion/adapted/struct/detail/adapt_is_tpl.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2013-2014 Damien Buhl
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_IS_TPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_ADAPT_IS_TPL_HPP
|
||||
|
||||
#define BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ) \
|
||||
BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ)
|
||||
|
||||
#endif
|
@ -34,6 +34,13 @@
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_FILLER_0(X, Y) \
|
||||
((X, Y)) BOOST_FUSION_DEFINE_STRUCT_FILLER_1
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_FILLER_1(X, Y) \
|
||||
((X, Y)) BOOST_FUSION_DEFINE_STRUCT_FILLER_0
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_FILLER_0_END
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_FILLER_1_END
|
||||
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_COPY_CTOR_FILLER_I( \
|
||||
R, ATTRIBUTE_TUPEL_SIZE, I, ATTRIBUTE) \
|
||||
\
|
||||
|
@ -302,7 +302,7 @@
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_INLINE_MEMBERS(NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_DEFINE_STRUCT_MEMBERS_IMPL( \
|
||||
NAME, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END))
|
||||
BOOST_PP_CAT(BOOST_FUSION_DEFINE_STRUCT_FILLER_0 ATTRIBUTES,_END))
|
||||
|
||||
// Note: can't compute BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ) directly because
|
||||
// ATTRIBUTES_SEQ may be empty and calling BOOST_PP_SEQ_SIZE on an empty
|
||||
@ -316,7 +316,7 @@
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR(NAME, ATTRIBUTES) \
|
||||
BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL( \
|
||||
NAME, \
|
||||
BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END))
|
||||
BOOST_PP_CAT(BOOST_FUSION_DEFINE_STRUCT_FILLER_0 ATTRIBUTES,_END))
|
||||
|
||||
#define BOOST_FUSION_DEFINE_STRUCT_ITERATOR_IMPL(NAME, ATTRIBUTES_SEQ) \
|
||||
BOOST_FUSION_DEFINE_STRUCT_INLINE_ITERATOR_IMPL_IMPL( \
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
BOOST_PP_VARIADICS version of BOOST_PP_IS_SEQ inspired from
|
||||
boost/mpl/aux_/preprocessor/is_seq.hpp, original copyrights goes to :
|
||||
|
||||
Copyright Paul Mensonides 2003
|
||||
Copyright Aleksey Gurtovoy 2003-2004
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_STRUCT_DETAIL_PREPROCESSOR_IS_SEQ_HPP
|
||||
#define BOOST_FUSION_ADAPTED_STRUCT_DETAIL_PREPROCESSOR_IS_SEQ_HPP
|
||||
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/punctuation/paren.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/config/config.hpp>
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
#define BOOST_FUSION_PP_IS_SEQ(seq) BOOST_PP_CAT(BOOST_FUSION_PP_IS_SEQ_, \
|
||||
BOOST_FUSION_PP_IS_SEQ_0 seq BOOST_PP_RPAREN())
|
||||
|
||||
#define BOOST_FUSION_PP_IS_SEQ_0(...) \
|
||||
BOOST_FUSION_PP_IS_SEQ_1(__VA_ARGS__
|
||||
|
||||
#define BOOST_FUSION_PP_IS_SEQ_ALWAYS_0(...) \
|
||||
0
|
||||
|
||||
#define BOOST_FUSION_PP_IS_SEQ_BOOST_FUSION_PP_IS_SEQ_0 \
|
||||
BOOST_FUSION_PP_IS_SEQ_ALWAYS_0(
|
||||
|
||||
#define BOOST_FUSION_PP_IS_SEQ_BOOST_FUSION_PP_IS_SEQ_1(...) \
|
||||
1
|
||||
|
||||
#endif // BOOST_PP_VARIADICS
|
||||
|
||||
#endif
|
@ -12,6 +12,8 @@
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/adapted/struct/detail/namespace.hpp>
|
||||
|
||||
#define BOOST_FUSION_PROXY_PREFIX() obj.
|
||||
|
||||
#define BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE_IMPL( \
|
||||
WRAPPED_TYPE,NAMESPACE_SEQ,NAME) \
|
||||
\
|
||||
|
@ -118,4 +118,13 @@ namespace boost { namespace fusion {
|
||||
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Seq, int Pos>
|
||||
struct iterator_traits< ::boost::fusion::deque_iterator<Seq, Pos> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -141,7 +141,10 @@ FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
{}
|
||||
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>&& seq)
|
||||
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>&& seq
|
||||
, typename disable_if<
|
||||
is_convertible<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>, T0>
|
||||
>::type* /*dummy*/ = 0)
|
||||
: base(std::forward<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)>>(seq))
|
||||
{}
|
||||
template <typename T>
|
||||
|
@ -66,7 +66,8 @@ namespace boost { namespace fusion { namespace detail
|
||||
|
||||
template <typename U, typename Rst>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
keyed_element(keyed_element<Key, U, Rst> const& rhs)
|
||||
keyed_element(keyed_element<Key, U, Rst> const& rhs
|
||||
, typename enable_if<is_convertible<U, Value> >::type* = 0)
|
||||
: Rest(rhs.get_base()), value_(rhs.value_)
|
||||
{}
|
||||
|
||||
|
@ -99,4 +99,13 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Cons>
|
||||
struct iterator_traits< ::boost::fusion::cons_iterator<Cons> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -24,6 +24,15 @@
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
|
||||
defined(BOOST_MSVC) && (BOOST_MSVC == 1700)
|
||||
// see map_forward_ctor.hpp
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
|
||||
#include <boost/fusion/container/map/detail/cpp03/preprocessed/map.hpp>
|
||||
@ -45,6 +54,8 @@
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define FUSION_HASH #
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_;
|
||||
@ -69,6 +80,10 @@ namespace boost { namespace fusion
|
||||
map()
|
||||
: data() {}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
map(map const& rhs)
|
||||
: data(rhs.data) {}
|
||||
|
||||
template <typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
map(Sequence const& rhs)
|
||||
@ -91,6 +106,34 @@ namespace boost { namespace fusion
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
|
||||
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
map(map&& rhs)
|
||||
: data(std::move(rhs.data)) {}
|
||||
|
||||
template <typename T>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
map& operator=(T&& rhs)
|
||||
{
|
||||
data = BOOST_FUSION_FWD_ELEM(T, rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
map& operator=(map&& rhs)
|
||||
{
|
||||
data = std::move(rhs.data);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH endif
|
||||
#endif
|
||||
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
storage_type& get_data() { return data; }
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
@ -102,6 +145,8 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#undef FUSION_HASH
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
@ -8,15 +8,14 @@
|
||||
#if !defined(FUSION_MAP_FORWARD_CTOR_07222005_0106)
|
||||
#define FUSION_MAP_FORWARD_CTOR_07222005_0106
|
||||
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#define FUSION_FORWARD_CTOR_FORWARD(z, n, _) BOOST_FUSION_FWD_ELEM(U##n, _##n)
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/container/map/detail/cpp03/map_forward_ctor.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_MAP_SIZE)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_FORWARD_CTOR_FORWARD
|
||||
#endif
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -34,6 +33,31 @@
|
||||
map(BOOST_PP_ENUM_BINARY_PARAMS(N, typename detail::call_param<T, >::type arg))
|
||||
: data(BOOST_PP_ENUM_PARAMS(N, arg)) {}
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#endif
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
|
||||
(defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES))
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
#if N == 1
|
||||
explicit
|
||||
#endif
|
||||
map(BOOST_PP_ENUM_BINARY_PARAMS(N, U, && arg)
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES) && \
|
||||
N == 1
|
||||
// workaround for MSVC 10
|
||||
FUSION_HASH if defined(BOOST_MSVC) && (BOOST_MSVC == 1700)
|
||||
, typename enable_if<is_same<U0, T0> >::type* = 0
|
||||
FUSION_HASH endif
|
||||
#endif
|
||||
)
|
||||
: data(BOOST_PP_ENUM(N, FUSION_FORWARD_CTOR_FORWARD, arg)) {}
|
||||
#endif
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
FUSION_HASH endif
|
||||
#endif
|
||||
|
||||
#undef N
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
|
@ -163,4 +163,13 @@ namespace boost { namespace fusion
|
||||
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Seq, int Pos>
|
||||
struct iterator_traits< ::boost::fusion::map_iterator<Seq, Pos> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -49,5 +49,14 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Vector, int N>
|
||||
struct iterator_traits< ::boost::fusion::vector_iterator<Vector, N> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -144,4 +144,13 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Tag, typename Category, typename Seq, int Index>
|
||||
struct iterator_traits< ::boost::fusion::basic_iterator<Tag, Category, Seq, Index> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -135,4 +135,13 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Derived, typename Iterator, typename Category>
|
||||
struct iterator_traits< ::boost::fusion::iterator_adapter<Derived, Iterator, Category> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -56,4 +56,13 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Derived, typename Category>
|
||||
struct iterator_traits< ::boost::fusion::iterator_facade<Derived, Category> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -68,4 +68,23 @@ namespace boost { namespace fusion { namespace detail
|
||||
# define BOOST_FUSION_FWD_ELEM(type, value) std::forward<type>(value)
|
||||
#endif
|
||||
|
||||
|
||||
// Workaround for LWG 2408: C++17 SFINAE-friendly std::iterator_traits.
|
||||
// http://cplusplus.github.io/LWG/lwg-defects.html#2408
|
||||
//
|
||||
// - GCC 4.5 enables the feature under C++11.
|
||||
// https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01105.html
|
||||
//
|
||||
// - Only MSVC 12.0 doesn't have the feature.
|
||||
#if (defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 40500) && \
|
||||
defined(BOOST_LIBSTDCXX11)) || \
|
||||
(defined(BOOST_MSVC) && (BOOST_MSVC == 1800))
|
||||
# define BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename>
|
||||
struct iterator_traits;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace fusion { namespace traits
|
||||
{
|
||||
template <typename T> struct deduce;
|
||||
@ -86,6 +90,21 @@ namespace boost { namespace fusion { namespace traits
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
// Also unwrap C++11 std::ref if available (referencee cv is deduced)
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
template <typename T>
|
||||
struct deduce<std::reference_wrapper<T> &>
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct deduce<std::reference_wrapper<T> const &>
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
#endif
|
||||
|
||||
// Keep references on arrays, even if const
|
||||
|
||||
template <typename T, int N>
|
||||
|
@ -11,6 +11,10 @@
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
@ -25,6 +29,14 @@ namespace boost { namespace fusion { namespace detail
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
template <typename T>
|
||||
struct as_fusion_element<std::reference_wrapper<T> >
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename T, int N>
|
||||
struct as_fusion_element<T[N]>
|
||||
{
|
||||
|
@ -67,6 +67,15 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Category, typename First, typename Last, typename Pred>
|
||||
struct iterator_traits< ::boost::fusion::filter_iterator<Category, First, Last, Pred> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -204,6 +204,15 @@ namespace boost { namespace fusion { namespace extension
|
||||
};
|
||||
}}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename First, typename Base>
|
||||
struct iterator_traits< ::boost::fusion::flatten_view_iterator<First, Base> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -56,6 +56,15 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Category, typename First, typename Last, typename Concat>
|
||||
struct iterator_traits< ::boost::fusion::joint_view_iterator<Category, First, Last, Concat> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -55,6 +55,15 @@ namespace boost { namespace fusion
|
||||
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Sequence, typename Pos>
|
||||
struct iterator_traits< ::boost::fusion::nview_iterator<Sequence, Pos> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -53,5 +53,14 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Sequence, typename Pos>
|
||||
struct iterator_traits< ::boost::fusion::repetitive_view_iterator<Sequence, Pos> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -54,5 +54,14 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename First>
|
||||
struct iterator_traits< ::boost::fusion::reverse_view_iterator<First> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -51,6 +51,15 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename SingleView, typename Pos>
|
||||
struct iterator_traits< ::boost::fusion::single_view_iterator<SingleView, Pos> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
@ -76,5 +76,17 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename First, typename F>
|
||||
struct iterator_traits< ::boost::fusion::transform_view_iterator<First, F> >
|
||||
{ };
|
||||
template <typename First1, typename First2, typename F>
|
||||
struct iterator_traits< ::boost::fusion::transform_view_iterator2<First1, First2, F> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -46,4 +46,13 @@ namespace boost { namespace fusion {
|
||||
};
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename IteratorSequence, typename Traversal>
|
||||
struct iterator_traits< ::boost::fusion::zip_view_iterator<IteratorSequence, Traversal> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -95,7 +95,7 @@ main()
|
||||
#endif
|
||||
|
||||
{
|
||||
boost::array<std::size_t, 2> a = { 10, 50 };
|
||||
boost::array<std::size_t, 2> a = {{ 10, 50 }};
|
||||
BOOST_TEST(back(pop_back(a)) == 10);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/fusion/functional/invocation/invoke.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
@ -146,11 +147,28 @@ class members
|
||||
int binary_c(int i, object) const { return data + 6 + i; }
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SMART_PTR
|
||||
typedef std::auto_ptr<members > members_ptr;
|
||||
typedef std::auto_ptr<members const> const_members_ptr;
|
||||
#else
|
||||
typedef std::unique_ptr<members > members_ptr;
|
||||
typedef std::unique_ptr<members const> const_members_ptr;
|
||||
#endif
|
||||
|
||||
struct derived
|
||||
: members
|
||||
{
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SMART_PTR
|
||||
typedef std::auto_ptr<derived > derived_ptr;
|
||||
typedef std::auto_ptr<derived const> const_derived_ptr;
|
||||
#else
|
||||
typedef std::unique_ptr<derived > derived_ptr;
|
||||
typedef std::unique_ptr<derived const> const_derived_ptr;
|
||||
#endif
|
||||
|
||||
|
||||
typedef int element1_type;
|
||||
typedef object element2_type;
|
||||
typedef object_nc & element3_type;
|
||||
@ -161,8 +179,8 @@ object_nc element3;
|
||||
|
||||
members that;
|
||||
|
||||
std::auto_ptr<members> spt_that(new members);
|
||||
std::auto_ptr<members const> spt_that_c(new members);
|
||||
members_ptr spt_that(new members);
|
||||
const_members_ptr spt_that_c(new members);
|
||||
|
||||
fusion::single_view<members > sv_obj_ctx( that);
|
||||
fusion::single_view<members &> sv_ref_ctx( that);
|
||||
@ -170,13 +188,13 @@ fusion::single_view<members *> sv_ptr_ctx(& that);
|
||||
fusion::single_view<members const > sv_obj_c_ctx( that);
|
||||
fusion::single_view<members const &> sv_ref_c_ctx( that);
|
||||
fusion::single_view<members const *> sv_ptr_c_ctx(& that);
|
||||
fusion::single_view<std::auto_ptr<members> const &> sv_spt_ctx(spt_that);
|
||||
fusion::single_view< std::auto_ptr<members const> const &> sv_spt_c_ctx(spt_that_c);
|
||||
fusion::single_view<members_ptr const &> sv_spt_ctx(spt_that);
|
||||
fusion::single_view<const_members_ptr const &> sv_spt_c_ctx(spt_that_c);
|
||||
|
||||
derived derived_that;
|
||||
|
||||
std::auto_ptr<derived> spt_derived_that(new derived);
|
||||
std::auto_ptr<derived const> spt_derived_that_c(new derived);
|
||||
derived_ptr spt_derived_that(new derived);
|
||||
const_derived_ptr spt_derived_that_c(new derived);
|
||||
|
||||
fusion::single_view<derived > sv_obj_d_ctx( derived_that);
|
||||
fusion::single_view<derived &> sv_ref_d_ctx( derived_that);
|
||||
@ -184,8 +202,8 @@ fusion::single_view<derived *> sv_ptr_d_ctx(& derived_that);
|
||||
fusion::single_view<derived const > sv_obj_c_d_ctx( derived_that);
|
||||
fusion::single_view<derived const &> sv_ref_c_d_ctx( derived_that);
|
||||
fusion::single_view<derived const *> sv_ptr_c_d_ctx(& derived_that);
|
||||
fusion::single_view<std::auto_ptr<derived> const &> sv_spt_d_ctx(spt_derived_that);
|
||||
fusion::single_view< std::auto_ptr<derived const> const &> sv_spt_c_d_ctx(spt_derived_that_c);
|
||||
fusion::single_view<derived_ptr const &> sv_spt_d_ctx(spt_derived_that);
|
||||
fusion::single_view<const_derived_ptr const &> sv_spt_c_d_ctx(spt_derived_that_c);
|
||||
|
||||
template <class Sequence>
|
||||
void test_sequence_n(Sequence & seq, mpl::int_<0>)
|
||||
|
@ -7,6 +7,7 @@
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/fusion/functional/invocation/invoke_procedure.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
@ -65,9 +66,17 @@ class members
|
||||
int binary_c(int & i, object) const { return i = data + 6; }
|
||||
};
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SMART_PTR
|
||||
typedef std::auto_ptr<members > members_ptr;
|
||||
typedef std::auto_ptr<members const> const_members_ptr;
|
||||
#else
|
||||
typedef std::unique_ptr<members > members_ptr;
|
||||
typedef std::unique_ptr<members const> const_members_ptr;
|
||||
#endif
|
||||
|
||||
members that;
|
||||
std::auto_ptr<members> spt_that(new members);
|
||||
std::auto_ptr<members const> spt_that_c(new members);
|
||||
members_ptr spt_that(new members);
|
||||
const_members_ptr spt_that_c(new members);
|
||||
|
||||
fusion::single_view<members > sv_obj_ctx( that);
|
||||
fusion::single_view<members &> sv_ref_ctx( that);
|
||||
@ -75,8 +84,8 @@ fusion::single_view<members *> sv_ptr_ctx(& that);
|
||||
fusion::single_view<members const > sv_obj_c_ctx( that);
|
||||
fusion::single_view<members const &> sv_ref_c_ctx( that);
|
||||
fusion::single_view<members const *> sv_ptr_c_ctx(& that);
|
||||
fusion::single_view<std::auto_ptr<members> const &> sv_spt_ctx(spt_that);
|
||||
fusion::single_view< std::auto_ptr<members const> const &> sv_spt_c_ctx(spt_that_c);
|
||||
fusion::single_view<members_ptr const &> sv_spt_ctx(spt_that);
|
||||
fusion::single_view<const_members_ptr const &> sv_spt_c_ctx(spt_that_c);
|
||||
|
||||
struct fobj
|
||||
{
|
||||
|
@ -38,18 +38,21 @@ namespace ns
|
||||
{
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(int in_x, int in_y) : x(in_x), y(in_y) {}
|
||||
point() : x(0), y(0), z(0) {}
|
||||
point(int in_x, int in_y, int in_z) : x(in_x), y(in_y), z(in_z) {}
|
||||
|
||||
int get_x() const { return x; }
|
||||
int get_y() const { return y; }
|
||||
int get_z() const { return z; }
|
||||
void set_x(int x_) { x = x_; }
|
||||
void set_y(int y_) { y = y_; }
|
||||
void set_z(int z_) { z = z_; }
|
||||
|
||||
private:
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
};
|
||||
|
||||
#if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
@ -58,17 +61,22 @@ namespace ns
|
||||
friend struct boost::fusion::extension::access;
|
||||
|
||||
public:
|
||||
point_with_private_members() : x(0), y(0) {}
|
||||
point_with_private_members(int x, int y) : x(x), y(y) {}
|
||||
point_with_private_members() : x(0), y(0), z(0) {}
|
||||
point_with_private_members(int in_x, int in_y, int in_z)
|
||||
: x(in_x), y(in_y), z(in_z) {}
|
||||
|
||||
private:
|
||||
int get_x() const { return x; }
|
||||
int get_y() const { return y; }
|
||||
int get_z() const { return z; }
|
||||
void set_x(int x_) { x = x_; }
|
||||
void set_y(int y_) { y = y_; }
|
||||
void set_z(int z_) { z = z_; }
|
||||
|
||||
private:
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -91,25 +99,55 @@ namespace ns
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
#if BOOST_PP_VARIADICS
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
ns::point,
|
||||
(int, int, obj.get_x(), obj.set_x(val))
|
||||
(int, int, obj.get_y(), obj.set_y(val))
|
||||
)
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_y(), obj.set_y(val))
|
||||
(obj.get_z(), obj.set_z(val))
|
||||
)
|
||||
|
||||
#if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
# if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
ns::point_with_private_members,
|
||||
(int, int, obj.get_x(), obj.set_x(val))
|
||||
(int, int, obj.get_y(), obj.set_y(val))
|
||||
)
|
||||
#endif
|
||||
(obj.get_x(), obj.set_x(val))
|
||||
(obj.get_y(), obj.set_y(val))
|
||||
(obj.get_z(), obj.set_z(val))
|
||||
)
|
||||
# endif
|
||||
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
ns::name,
|
||||
(obj.get_last(), obj.set_last(val))
|
||||
(obj.get_first(), obj.set_first(val))
|
||||
)
|
||||
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
ns::point,
|
||||
(int, int, obj.get_x(), obj.set_x(val))
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_y(), obj.set_y(val))
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_z(), obj.set_z(val))
|
||||
)
|
||||
|
||||
# if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
ns::point_with_private_members,
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_x(), obj.set_x(val))
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_y(), obj.set_y(val))
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_z(), obj.set_z(val))
|
||||
)
|
||||
# endif
|
||||
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
ns::name,
|
||||
(const std::string&, const std::string&, obj.get_last(), obj.set_last(val))
|
||||
(const std::string&, const std::string&, obj.get_first(), obj.set_first(val))
|
||||
)
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_first(), obj.set_first(val))
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
@ -123,28 +161,30 @@ main()
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
|
||||
ns::point p(123, 456);
|
||||
ns::point p(123, 456, 789);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
fusion::vector<int, float> v1(4, 2);
|
||||
ns::point v2(5, 3);
|
||||
fusion::vector<long, double> v3(5, 4);
|
||||
fusion::vector<int, float, int> v1(4, 2, 2);
|
||||
ns::point v2(5, 3, 3);
|
||||
fusion::vector<long, double, int> v3(5, 4, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -171,15 +211,15 @@ main()
|
||||
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p(5, 3);
|
||||
fusion::vector<int, long> v(p);
|
||||
ns::point p(5, 3, 3);
|
||||
fusion::vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p(5, 3);
|
||||
fusion::list<int, long> l(p);
|
||||
ns::point p(5, 3, 3);
|
||||
fusion::list<int, long, int> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
@ -193,26 +233,29 @@ main()
|
||||
#if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point_with_private_members>));
|
||||
ns::point_with_private_members p(123, 456);
|
||||
ns::point_with_private_members p(123, 456, 789);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point_with_private_members>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point_with_private_members>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point_with_private_members>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
// Check types provided in case it's provided
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<
|
||||
boost::fusion::result_of::front<ns::point>::type,
|
||||
@ -233,6 +276,28 @@ main()
|
||||
boost::fusion::result_of::front<ns::point const>::type::type,
|
||||
int
|
||||
>));
|
||||
|
||||
// Check types provided in case it's deduced
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<
|
||||
boost::fusion::result_of::back<ns::point>::type,
|
||||
boost::fusion::extension::adt_attribute_proxy<ns::point,2,false>
|
||||
>));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<
|
||||
boost::fusion::result_of::back<ns::point>::type::type,
|
||||
int
|
||||
>));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<
|
||||
boost::fusion::result_of::back<ns::point const>::type,
|
||||
boost::fusion::extension::adt_attribute_proxy<ns::point,2,true>
|
||||
>));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<
|
||||
boost::fusion::result_of::back<ns::point const>::type::type,
|
||||
const int
|
||||
>));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
@ -37,28 +37,46 @@ namespace ns
|
||||
{
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(int in_x, int in_y) : x(in_x), y(in_y) {}
|
||||
point() : x(0), y(0), z(0) {}
|
||||
point(int in_x, int in_y, int in_z) : x(in_x), y(in_y), z(in_z) {}
|
||||
|
||||
int get_x() const { return x; }
|
||||
int get_y() const { return y; }
|
||||
int get_z() const { return z; }
|
||||
void set_x(int x_) { x = x_; }
|
||||
void set_y(int y_) { y = y_; }
|
||||
void set_z(int z_) { z = z_; }
|
||||
|
||||
private:
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
};
|
||||
}
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
// this creates a fusion view: boost::fusion::adapted::point
|
||||
BOOST_FUSION_ADAPT_ADT_NAMED(
|
||||
ns::point, point,
|
||||
(int, int, obj.obj.get_x(), obj.obj.set_x(val))
|
||||
(int, int, obj.obj.get_y(), obj.obj.set_y(val))
|
||||
(int, int, obj.get_x(), obj.set_x(val))
|
||||
(int, int, obj.get_y(), obj.set_y(val))
|
||||
(obj.get_z(), obj.set_z(val))
|
||||
)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
// this creates a fusion view: boost::fusion::adapted::point
|
||||
BOOST_FUSION_ADAPT_ADT_NAMED(
|
||||
ns::point, point,
|
||||
(int, int, obj.get_x(), obj.set_x(val))
|
||||
(int, int, obj.get_y(), obj.set_y(val))
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_z(), obj.set_z(val))
|
||||
)
|
||||
|
||||
#endif // BOOST_PP_VARIADICS
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
@ -71,31 +89,33 @@ main()
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
|
||||
ns::point basep(123, 456);
|
||||
ns::point basep(123, 456, 789);
|
||||
adapted::point p(basep);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
fusion::vector<int, float> v1(4, 2);
|
||||
ns::point basep(5, 3);
|
||||
fusion::vector<int, float, int> v1(4, 2, 2);
|
||||
ns::point basep(5, 3, 3);
|
||||
adapted::point v2(basep);
|
||||
|
||||
fusion::vector<long, double> v3(5, 4);
|
||||
fusion::vector<long, double, int> v3(5, 4, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -108,19 +128,19 @@ main()
|
||||
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point basep(5, 3);
|
||||
ns::point basep(5, 3, 3);
|
||||
adapted::point p(basep);
|
||||
|
||||
fusion::vector<int, long> v(p);
|
||||
fusion::vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point basep(5, 3);
|
||||
ns::point basep(5, 3, 3);
|
||||
adapted::point p(basep);
|
||||
|
||||
fusion::list<int, long> l(p);
|
||||
fusion::list<int, long, float> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -26,31 +26,50 @@ namespace ns
|
||||
struct y_member;
|
||||
struct z_member;
|
||||
|
||||
struct non_member;
|
||||
|
||||
class point
|
||||
{
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(int in_x, int in_y) : x(in_x), y(in_y) {}
|
||||
point() : x(0), y(0), z(0) {}
|
||||
point(int in_x, int in_y, int in_z) : x(in_x), y(in_y), z(in_z) {}
|
||||
|
||||
int get_x() const { return x; }
|
||||
int get_y() const { return y; }
|
||||
int get_z() const { return z; }
|
||||
void set_x(int x_) { x = x_; }
|
||||
void set_y(int y_) { y = y_; }
|
||||
void set_z(int z_) { z = z_; }
|
||||
|
||||
private:
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
};
|
||||
}
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT(
|
||||
ns::point,
|
||||
(int, int, obj.get_x(), obj.set_x(val), ns::x_member)
|
||||
(int, int, obj.get_y(), obj.set_y(val), ns::y_member)
|
||||
(obj.get_z(), obj.set_z(val), ns::z_member)
|
||||
)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT(
|
||||
ns::point,
|
||||
(int, int, obj.get_x(), obj.set_x(val), ns::x_member)
|
||||
(int, int, obj.get_y(), obj.set_y(val), ns::y_member)
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_z(), obj.set_z(val), ns::z_member)
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
@ -62,28 +81,30 @@ main()
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
|
||||
ns::point p(123, 456);
|
||||
ns::point p(123, 456, 789);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
boost::fusion::vector<int, float> v1(4, 2);
|
||||
ns::point v2(5, 3);
|
||||
boost::fusion::vector<long, double> v3(5, 4);
|
||||
boost::fusion::vector<int, float, int> v1(4, 2, 2);
|
||||
ns::point v2(5, 3, 3);
|
||||
boost::fusion::vector<long, double, int> v3(5, 4, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -96,15 +117,15 @@ main()
|
||||
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p(5, 3);
|
||||
boost::fusion::vector<int, long> v(p);
|
||||
ns::point p(5, 3, 3);
|
||||
boost::fusion::vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p(5, 3);
|
||||
boost::fusion::list<int, long> l(p);
|
||||
ns::point p(5, 3, 3);
|
||||
boost::fusion::list<int, long, int> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
@ -119,15 +140,19 @@ main()
|
||||
// assoc stuff
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
|
||||
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::z_member> >));
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::z_member>));
|
||||
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::non_member> >));
|
||||
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::z_member>::type, int>));
|
||||
|
||||
ns::point p(5, 3);
|
||||
ns::point p(5, 3, 1);
|
||||
|
||||
BOOST_TEST(at_key<ns::x_member>(p) == 5);
|
||||
BOOST_TEST(at_key<ns::y_member>(p) == 3);
|
||||
BOOST_TEST(at_key<ns::z_member>(p) == 1);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
@ -48,8 +48,8 @@ namespace ns
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT_NAMED(
|
||||
ns::point,
|
||||
point,
|
||||
(int, int, obj.obj.get_x(), obj.obj.set_x(val), ns::x_member)
|
||||
(int, int, obj.obj.get_y(), obj.obj.set_y(val), ns::y_member)
|
||||
(int, int, obj.get_x(), obj.set_x(val), ns::x_member)
|
||||
(int, int, obj.get_y(), obj.set_y(val), ns::y_member)
|
||||
)
|
||||
|
||||
int
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <boost/fusion/mpl.hpp>
|
||||
#include <boost/fusion/support/is_view.hpp>
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/back.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
@ -42,19 +43,33 @@ namespace ns
|
||||
struct x_member;
|
||||
struct y_member;
|
||||
struct z_member;
|
||||
struct non_member;
|
||||
|
||||
struct point
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
||||
#if BOOST_PP_VARIADICS
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
||||
ns::point,
|
||||
(int, x, ns::x_member)
|
||||
(int, y, ns::y_member)
|
||||
)
|
||||
(x, ns::x_member)
|
||||
(y, ns::y_member)
|
||||
(int, z, ns::z_member)
|
||||
)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
||||
ns::point,
|
||||
(BOOST_FUSION_ADAPT_AUTO, x, ns::x_member)
|
||||
(BOOST_FUSION_ADAPT_AUTO, y, ns::y_member)
|
||||
(int, z, ns::z_member)
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
@ -68,28 +83,30 @@ main()
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
|
||||
ns::point p = {123, 456};
|
||||
ns::point p = {123, 456, 789};
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
fusion::vector<int, float> v1(4, 2);
|
||||
ns::point v2 = {5, 3};
|
||||
fusion::vector<long, double> v3(5, 4);
|
||||
fusion::vector<int, float, int> v1(4, 2, 2);
|
||||
ns::point v2 = {5, 3, 3};
|
||||
fusion::vector<long, double, int> v3(5, 4, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -102,15 +119,15 @@ main()
|
||||
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p = {5, 3};
|
||||
fusion::vector<int, long> v(p);
|
||||
ns::point p = {5, 3, 3};
|
||||
fusion::vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p = {5, 3};
|
||||
fusion::list<int, long> l(p);
|
||||
ns::point p = {5, 3, 3};
|
||||
fusion::list<int, long, int> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
@ -118,15 +135,18 @@ main()
|
||||
// assoc stuff
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
|
||||
BOOST_MPL_ASSERT((mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::z_member> >));
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::z_member>));
|
||||
BOOST_MPL_ASSERT((mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::non_member> >));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::z_member>::type, int>));
|
||||
|
||||
ns::point p = {5, 3};
|
||||
ns::point p = {5, 3, 9};
|
||||
|
||||
BOOST_TEST(at_key<ns::x_member>(p) == 5);
|
||||
BOOST_TEST(at_key<ns::y_member>(p) == 3);
|
||||
BOOST_TEST(at_key<ns::z_member>(p) == 9);
|
||||
}
|
||||
|
||||
{
|
||||
@ -134,6 +154,9 @@ main()
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
boost::fusion::result_of::value_at_c<ns::point,0>::type
|
||||
, mpl::front<ns::point>::type>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
boost::fusion::result_of::value_at_c<ns::point,2>::type
|
||||
, mpl::back<ns::point>::type>));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
@ -26,39 +26,57 @@ namespace ns
|
||||
struct y_member;
|
||||
struct z_member;
|
||||
|
||||
template<typename X, typename Y>
|
||||
struct non_member;
|
||||
|
||||
template<typename X, typename Y, typename Z>
|
||||
class point
|
||||
{
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(X in_x, Y in_y) : x(in_x), y(in_y) {}
|
||||
point() : x(0), y(0), z(0) {}
|
||||
point(X in_x, Y in_y, Z in_z) : x(in_x), y(in_y), z(in_z) {}
|
||||
|
||||
X get_x() const { return x; }
|
||||
Y get_y() const { return y; }
|
||||
Z get_z() const { return z; }
|
||||
void set_x(X x_) { x = x_; }
|
||||
void set_y(Y y_) { y = y_; }
|
||||
void set_z(Z z_) { z = z_; }
|
||||
|
||||
private:
|
||||
|
||||
X x;
|
||||
Y y;
|
||||
Z z;
|
||||
};
|
||||
}
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_ADT(
|
||||
(X)(Y),
|
||||
(ns::point)(X)(Y),
|
||||
(X)(Y)(Z),
|
||||
(ns::point)(X)(Y)(Z),
|
||||
(X, X, obj.get_x(), obj.set_x(val), ns::x_member)
|
||||
(Y, Y, obj.get_y(), obj.set_y(val), ns::y_member)
|
||||
(obj.get_z(), obj.set_z(val), ns::z_member)
|
||||
)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_ADT(
|
||||
(X)(Y)(Z),
|
||||
(ns::point)(X)(Y)(Z),
|
||||
(X, X, obj.get_x(), obj.set_x(val), ns::x_member)
|
||||
(Y, Y, obj.get_y(), obj.set_y(val), ns::y_member)
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_z(), obj.set_z(val), ns::z_member)
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
|
||||
typedef ns::point<int,int> point;
|
||||
typedef ns::point<int,int,long> point;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
@ -66,28 +84,30 @@ main()
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
|
||||
point p(123, 456);
|
||||
point p(123, 456, 789);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
boost::fusion::vector<int, float> v1(4, 2);
|
||||
point v2(5, 3);
|
||||
boost::fusion::vector<long, double> v3(5, 4);
|
||||
boost::fusion::vector<int, float, long> v1(4, 2, 2);
|
||||
point v2(5, 3, 3);
|
||||
boost::fusion::vector<long, double, long> v3(5, 4, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -100,15 +120,15 @@ main()
|
||||
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p(5, 3);
|
||||
boost::fusion::vector<int, long> v(p);
|
||||
point p(5, 3, 3);
|
||||
boost::fusion::vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p(5, 3);
|
||||
boost::fusion::list<int, long> l(p);
|
||||
point p(5, 3, 3);
|
||||
boost::fusion::list<int, long, int> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
@ -123,15 +143,18 @@ main()
|
||||
// assoc stuff
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
|
||||
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::z_member> >));
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::z_member>));
|
||||
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::non_member> >));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::z_member>::type, long>));
|
||||
|
||||
point p(5, 3);
|
||||
point p(5, 3, 1);
|
||||
|
||||
BOOST_TEST(at_key<ns::x_member>(p) == 5);
|
||||
BOOST_TEST(at_key<ns::y_member>(p) == 3);
|
||||
BOOST_TEST(at_key<ns::z_member>(p) == 1);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
@ -39,27 +39,42 @@ namespace ns
|
||||
struct y_member;
|
||||
struct z_member;
|
||||
|
||||
template<typename X, typename Y>
|
||||
struct non_member;
|
||||
|
||||
template<typename X, typename Y, typename Z>
|
||||
struct point
|
||||
{
|
||||
X x;
|
||||
Y y;
|
||||
Z z;
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
|
||||
(X)(Y),
|
||||
(ns::point)(X)(Y),
|
||||
#if BOOST_PP_VARIADICS
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
|
||||
(X)(Y)(Z),
|
||||
(ns::point)(X)(Y)(Z),
|
||||
(int, x, ns::x_member)
|
||||
(int, y, ns::y_member)
|
||||
)
|
||||
(Y, y, ns::y_member)
|
||||
(z, ns::z_member)
|
||||
)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
|
||||
(X)(Y)(Z),
|
||||
(ns::point)(X)(Y)(Z),
|
||||
(int, x, ns::x_member)
|
||||
(Y, y, ns::y_member)
|
||||
(BOOST_FUSION_ADAPT_AUTO, z, ns::z_member)
|
||||
)
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
|
||||
typedef ns::point<int,int> point;
|
||||
typedef ns::point<int,int,float> point;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
@ -67,28 +82,30 @@ main()
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
|
||||
point p = {123, 456};
|
||||
point p = {123, 456, 789.43f};
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789.43f));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
vector<int, float> v1(4, 2);
|
||||
point v2 = {5, 3};
|
||||
vector<long, double> v3(5, 4);
|
||||
vector<int, float, int> v1(4, 2, 2);
|
||||
point v2 = {5, 3, 3};
|
||||
vector<long, double, float> v3(5, 4, 4.13f);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -101,15 +118,15 @@ main()
|
||||
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p = {5, 3};
|
||||
vector<int, long> v(p);
|
||||
point p = {5, 3, 3};
|
||||
vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p = {5, 3};
|
||||
list<int, long> l(p);
|
||||
point p = {5, 3, 3};
|
||||
list<int, long, int> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
@ -117,15 +134,18 @@ main()
|
||||
// assoc stuff
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
|
||||
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::z_member> >));
|
||||
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::z_member>));
|
||||
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::non_member> >));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::z_member>::type, float>));
|
||||
|
||||
point p = {5, 3};
|
||||
point p = {5, 3, 9};
|
||||
|
||||
BOOST_TEST(at_key<ns::x_member>(p) == 5);
|
||||
BOOST_TEST(at_key<ns::y_member>(p) == 3);
|
||||
BOOST_TEST(at_key<ns::z_member>(p) == 9);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
@ -38,6 +38,7 @@ namespace ns
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
};
|
||||
|
||||
#if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
@ -48,9 +49,10 @@ namespace ns
|
||||
private:
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
public:
|
||||
point_with_private_attributes(int x, int y):x(x),y(y)
|
||||
point_with_private_attributes(int x, int y, int z):x(x),y(y),z(z)
|
||||
{}
|
||||
};
|
||||
#endif
|
||||
@ -67,63 +69,99 @@ namespace ns
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
ns::point,
|
||||
x,
|
||||
y,
|
||||
z
|
||||
)
|
||||
|
||||
# if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
ns::point_with_private_attributes,
|
||||
x,
|
||||
y,
|
||||
z
|
||||
)
|
||||
# endif
|
||||
|
||||
struct s { int m; };
|
||||
BOOST_FUSION_ADAPT_STRUCT(s, m)
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
ns::bar,
|
||||
foo_.x, // test that adapted members can actually be expressions
|
||||
y
|
||||
)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
ns::point,
|
||||
(int, x)
|
||||
(int, y)
|
||||
)
|
||||
(BOOST_FUSION_ADAPT_AUTO, z)
|
||||
)
|
||||
|
||||
#if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
# if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
ns::point_with_private_attributes,
|
||||
(int, x)
|
||||
(int, y)
|
||||
)
|
||||
#endif
|
||||
(BOOST_FUSION_ADAPT_AUTO, z)
|
||||
)
|
||||
# endif
|
||||
|
||||
struct s { int m; };
|
||||
BOOST_FUSION_ADAPT_STRUCT(s, (int, m))
|
||||
struct s { int m; };
|
||||
BOOST_FUSION_ADAPT_STRUCT(s, (BOOST_FUSION_ADAPT_AUTO, m))
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
ns::bar,
|
||||
(int, foo_.x) // test that adapted members can actually be expressions
|
||||
(int, y)
|
||||
)
|
||||
(BOOST_FUSION_ADAPT_AUTO, foo_.x) // test that adapted members can actually be expressions
|
||||
(BOOST_FUSION_ADAPT_AUTO, y)
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using namespace boost;
|
||||
using ns::point;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
|
||||
ns::point p = {123, 456};
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
|
||||
point p = {123, 456, 789};
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
fusion::vector<int, float> v1(4, 2);
|
||||
ns::point v2 = {5, 3};
|
||||
fusion::vector<long, double> v3(5, 4);
|
||||
vector<int, float, int> v1(4, 2, 2);
|
||||
point v2 = {5, 3, 3};
|
||||
vector<long, double, int> v3(5, 4, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -135,16 +173,16 @@ main()
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to vector
|
||||
ns::point p = {5, 3};
|
||||
fusion::vector<int, long> v(p);
|
||||
// conversion from point to vector
|
||||
point p = {5, 3, 3};
|
||||
vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from ns::point to list
|
||||
ns::point p = {5, 3};
|
||||
fusion::list<int, long> l(p);
|
||||
// conversion from point to list
|
||||
point p = {5, 3, 3};
|
||||
list<int, long, int> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
@ -167,18 +205,19 @@ main()
|
||||
|
||||
#if !BOOST_WORKAROUND(__GNUC__,<4)
|
||||
{
|
||||
ns::point_with_private_attributes p(123, 456);
|
||||
ns::point_with_private_attributes p(123, 456, 789);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
fusion::vector<int, float> v1(4, 2);
|
||||
ns::bar v2 = {5, 3};
|
||||
ns::bar v2 = {{5}, 3};
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
|
@ -37,19 +37,39 @@ namespace ns
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
};
|
||||
}
|
||||
|
||||
// this creates a fusion view: boost::fusion::adapted::point
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
// this creates a fusion view: boost::fusion::adapted::point
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
||||
ns::point, point,
|
||||
x,
|
||||
y,
|
||||
z
|
||||
)
|
||||
|
||||
// this creates a fusion view: ns1::s1
|
||||
struct s { int m; };
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(s, (ns1), s1, m)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
// this creates a fusion view: boost::fusion::adapted::point
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
||||
ns::point, point,
|
||||
(int, x)
|
||||
(int, y)
|
||||
)
|
||||
(BOOST_FUSION_ADAPT_AUTO, z)
|
||||
)
|
||||
|
||||
// this creates a fusion view: ns1::s1
|
||||
struct s { int m; };
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(s, (ns1), s1, (int, m))
|
||||
// this creates a fusion view: ns1::s1
|
||||
struct s { int m; };
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(s, (ns1), s1, (BOOST_FUSION_ADAPT_AUTO, m))
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
@ -63,31 +83,33 @@ main()
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
|
||||
ns::point basep = {123, 456};
|
||||
ns::point basep = {123, 456, 789};
|
||||
adapted::point p(basep);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
fusion::vector<int, float> v1(4, 2);
|
||||
ns::point p = {5, 3};
|
||||
fusion::vector<int, float, int> v1(4, 2, 2);
|
||||
ns::point p = {5, 3, 3};
|
||||
adapted::point v2(p);
|
||||
|
||||
fusion::vector<long, double> v3(5, 4);
|
||||
fusion::vector<long, double, int> v3(5, 4, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -100,17 +122,17 @@ main()
|
||||
|
||||
{
|
||||
// conversion from adapted::point to vector
|
||||
ns::point basep = {5, 3};
|
||||
ns::point basep = {5, 3, 3};
|
||||
adapted::point p(basep);
|
||||
fusion::vector<int, long> v(p);
|
||||
fusion::vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from adapted::point to list
|
||||
ns::point basep = {5, 3};
|
||||
ns::point basep = {5, 3, 3};
|
||||
adapted::point p(basep);
|
||||
fusion::list<int, long> l(p);
|
||||
fusion::list<int, long, int> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -39,27 +39,45 @@ namespace ns
|
||||
{
|
||||
public:
|
||||
|
||||
point() : x(0), y(0) {}
|
||||
point(X x_, Y y_) : x(x_), y(y_) {}
|
||||
point() : x(0), y(0), z(0) {}
|
||||
point(X x_, Y y_, int z_) : x(x_), y(y_), z(z_) {}
|
||||
|
||||
X get_x() const { return x; }
|
||||
Y get_y() const { return y; }
|
||||
int get_z() const { return z; }
|
||||
void set_x(X x_) { x = x_; }
|
||||
void set_y(Y y_) { y = y_; }
|
||||
void set_z(int z_) { z = z_; }
|
||||
|
||||
private:
|
||||
|
||||
X x;
|
||||
Y y;
|
||||
int z;
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_FUSION_ADAPT_TPL_ADT(
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
BOOST_FUSION_ADAPT_TPL_ADT(
|
||||
(X)(Y),
|
||||
(ns::point)(X)(Y),
|
||||
(X, X, obj.get_x(), obj.set_x(val))
|
||||
(Y, Y, obj.get_y(), obj.set_y(val))
|
||||
)
|
||||
(obj.get_z(), obj.set_z(val))
|
||||
)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
BOOST_FUSION_ADAPT_TPL_ADT(
|
||||
(X)(Y),
|
||||
(ns::point)(X)(Y),
|
||||
(X, X, obj.get_x(), obj.set_x(val))
|
||||
(Y, Y, obj.get_y(), obj.set_y(val))
|
||||
(BOOST_FUSION_ADAPT_AUTO, BOOST_FUSION_ADAPT_AUTO, obj.get_z(), obj.set_z(val))
|
||||
)
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
@ -75,28 +93,30 @@ main()
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
|
||||
point p(123, 456);
|
||||
point p(123, 456, 789);
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
boost::fusion::vector<int, float> v1(4, 2);
|
||||
point v2(5, 3);
|
||||
boost::fusion::vector<long, double> v3(5, 4);
|
||||
boost::fusion::vector<int, float, int> v1(4, 2, 2);
|
||||
point v2(5, 3, 3);
|
||||
boost::fusion::vector<long, double, int> v3(5, 4, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -108,9 +128,9 @@ main()
|
||||
}
|
||||
|
||||
{
|
||||
boost::fusion::vector<std::string, std::string> v1("Lincoln", "Abraham");
|
||||
name v2("Roosevelt", "Franklin");
|
||||
name v3("Roosevelt", "Theodore");
|
||||
boost::fusion::vector<std::string, std::string, int> v1("Lincoln", "Abraham", 3);
|
||||
name v2("Roosevelt", "Franklin", 3);
|
||||
name v3("Roosevelt", "Theodore", 3);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -123,15 +143,15 @@ main()
|
||||
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p(5, 3);
|
||||
boost::fusion::vector<int, long> v(p);
|
||||
point p(5, 3, 3);
|
||||
boost::fusion::vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p(5, 3);
|
||||
boost::fusion::list<int, long> l(p);
|
||||
point p(5, 3, 3);
|
||||
boost::fusion::list<int, long, int> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
||||
|
@ -35,19 +35,40 @@ namespace ns
|
||||
{
|
||||
X x;
|
||||
Y y;
|
||||
int z;
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT(
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT(
|
||||
(X)(Y),
|
||||
(ns::point)(X)(Y),
|
||||
x,
|
||||
(BOOST_FUSION_ADAPT_AUTO, y)
|
||||
(int, z)
|
||||
)
|
||||
|
||||
template<typename M>
|
||||
struct s { M m; };
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT((M), (s)(M), m)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT(
|
||||
(X)(Y),
|
||||
(ns::point)(X)(Y),
|
||||
(X, x)
|
||||
(Y, y)
|
||||
)
|
||||
(BOOST_FUSION_ADAPT_AUTO, z)
|
||||
)
|
||||
|
||||
template<typename M>
|
||||
struct s { M m; };
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT((M), (s)(M), (BOOST_FUSION_ADAPT_AUTO, m))
|
||||
|
||||
#endif
|
||||
|
||||
template<typename M>
|
||||
struct s { M m; };
|
||||
BOOST_FUSION_ADAPT_TPL_STRUCT((M), (s)(M), (M, m))
|
||||
|
||||
int
|
||||
main()
|
||||
@ -62,28 +83,30 @@ main()
|
||||
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
|
||||
point p = {123, 456};
|
||||
point p = {123, 456, 789};
|
||||
|
||||
std::cout << at_c<0>(p) << std::endl;
|
||||
std::cout << at_c<1>(p) << std::endl;
|
||||
std::cout << at_c<2>(p) << std::endl;
|
||||
std::cout << p << std::endl;
|
||||
BOOST_TEST(p == make_vector(123, 456));
|
||||
BOOST_TEST(p == make_vector(123, 456, 789));
|
||||
|
||||
at_c<0>(p) = 6;
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
at_c<2>(p) = 12;
|
||||
BOOST_TEST(p == make_vector(6, 9, 12));
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
BOOST_TEST(back(p) == 12);
|
||||
}
|
||||
|
||||
{
|
||||
vector<int, float> v1(4, 2);
|
||||
point v2 = {5, 3};
|
||||
vector<long, double> v3(5, 4);
|
||||
vector<int, float, int> v1(4, 2, 2);
|
||||
point v2 = {5, 3, 3};
|
||||
vector<long, double, int> v3(5, 4, 4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
@ -96,14 +119,14 @@ main()
|
||||
|
||||
{
|
||||
// conversion from point to vector
|
||||
point p = {5, 3};
|
||||
vector<int, long> v(p);
|
||||
point p = {5, 3, 3};
|
||||
vector<int, long, int> v(p);
|
||||
v = p;
|
||||
}
|
||||
|
||||
{
|
||||
// conversion from point to list
|
||||
point p = {5, 3};
|
||||
point p = {5, 3, 3};
|
||||
list<int, long> l(p);
|
||||
l = p;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
==============================================================================*/
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/fusion/support/deduce_sequence.hpp>
|
||||
#include <boost/fusion/mpl.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
@ -13,6 +14,9 @@
|
||||
#include <boost/mpl/equal.hpp>
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
using boost::is_same;
|
||||
using boost::reference_wrapper;
|
||||
@ -66,6 +70,13 @@ int main()
|
||||
TEST_SAME_TYPE(deduce< reference_wrapper<int> const & >::type, int &);
|
||||
TEST_SAME_TYPE(deduce< reference_wrapper<int const> const & >::type, int const &);
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
TEST_SAME_TYPE(deduce< std::reference_wrapper<int> & >::type, int &);
|
||||
TEST_SAME_TYPE(deduce< std::reference_wrapper<int const> & >::type, int const &);
|
||||
TEST_SAME_TYPE(deduce< std::reference_wrapper<int> const & >::type, int &);
|
||||
TEST_SAME_TYPE(deduce< std::reference_wrapper<int const> const & >::type, int const &);
|
||||
#endif
|
||||
|
||||
TEST_SAME_TYPE(deduce< int(&)[2] >::type, int(&)[2]);
|
||||
TEST_SAME_TYPE(deduce< int const (&)[2] >::type, int const (&)[2]);
|
||||
TEST_SAME_TYPE(deduce< int volatile (&)[2] >::type, int volatile (&)[2]);
|
||||
|
@ -38,12 +38,12 @@ namespace test_detail
|
||||
return *this;
|
||||
}
|
||||
|
||||
x(x const& rhs)
|
||||
x(x const& /*rhs*/)
|
||||
{
|
||||
incr_copy();
|
||||
}
|
||||
|
||||
x& operator=(x const& rhs)
|
||||
x& operator=(x const& /*rhs*/)
|
||||
{
|
||||
incr_copy();
|
||||
return *this;
|
||||
|
@ -19,7 +19,8 @@
|
||||
#include <boost/fusion/adapted/boost_array.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/fusion/adapted/boost_tuple.hpp>
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \
|
||||
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#include <tuple>
|
||||
#include <boost/fusion/adapted/std_tuple.hpp>
|
||||
#endif
|
||||
@ -89,7 +90,8 @@ void test()
|
||||
check<boost::tuples::tuple<int, int, int> >();
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \
|
||||
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
{
|
||||
check<std::tuple<> >();
|
||||
check<std::tuple<int> >();
|
||||
|
@ -8,7 +8,8 @@
|
||||
|
||||
// The std_tuple_iterator adaptor only supports implementations
|
||||
// using variadic templates
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \
|
||||
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
#include <boost/fusion/adapted/std_tuple.hpp>
|
||||
|
||||
|