mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-30 04:27:30 +02:00
Documented BOOST_FUSION_ADAT_ASSOC* macros with type inference.
This commit is contained in:
@ -193,7 +193,7 @@ __random_access_sequence__.
|
|||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
// When BOOST_PP_VARIADICS is missing :
|
// Without BOOST_PP_VARIADICS support :
|
||||||
BOOST_FUSION_ADAPT_STRUCT(
|
BOOST_FUSION_ADAPT_STRUCT(
|
||||||
struct_name,
|
struct_name,
|
||||||
(member_type0, member_name0)
|
(member_type0, member_name0)
|
||||||
@ -211,8 +211,8 @@ 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
|
pairs declares the type and names of each of the struct members that are part of
|
||||||
the sequence.
|
the sequence.
|
||||||
|
|
||||||
Omitting the type or using BOOST_FUSION_ADAPT_AUTO can be used to infer the type,
|
When member_typeN is omitted or set to BOOST_FUSION_ADAPT_AUTO, the type is
|
||||||
as with decltype.
|
infered with Boost.TypeOf.
|
||||||
|
|
||||||
The macro should be used at global scope, and `struct_name` should be the fully
|
The macro should be used at global scope, and `struct_name` should be the fully
|
||||||
namespace qualified name of the struct to be adapted.
|
namespace qualified name of the struct to be adapted.
|
||||||
@ -238,7 +238,7 @@ namespace qualified name of the struct to be adapted.
|
|||||||
name,
|
name,
|
||||||
age)
|
age)
|
||||||
|
|
||||||
// When BOOST_PP_VARIADICS is missing :
|
// Without BOOST_PP_VARIADICS support :
|
||||||
BOOST_FUSION_ADAPT_STRUCT(
|
BOOST_FUSION_ADAPT_STRUCT(
|
||||||
demo::employee,
|
demo::employee,
|
||||||
(BOOST_FUSION_ADAPT_AUTO, name)
|
(BOOST_FUSION_ADAPT_AUTO, name)
|
||||||
@ -263,7 +263,7 @@ __random_access_sequence__.
|
|||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
// When BOOST_PP_VARIADICS is missing :
|
// Without BOOST_PP_VARIADICS support :
|
||||||
BOOST_FUSION_ADAPT_TPL_STRUCT(
|
BOOST_FUSION_ADAPT_TPL_STRUCT(
|
||||||
(template_param0)(template_param1)...,
|
(template_param0)(template_param1)...,
|
||||||
(struct_name) (specialization_param0)(specialization_param1)...,
|
(struct_name) (specialization_param0)(specialization_param1)...,
|
||||||
@ -287,8 +287,8 @@ 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
|
pairs declares the type and names of each of the struct members that are part of
|
||||||
the sequence.
|
the sequence.
|
||||||
|
|
||||||
Omitting the type or using BOOST_FUSION_ADAPT_AUTO can be used to infer the type,
|
When member_typeN is omitted or set to BOOST_FUSION_ADAPT_AUTO, the type is
|
||||||
as with decltype.
|
infered with Boost.TypeOf.
|
||||||
|
|
||||||
The macro should be used at global scope, and `struct_name` should be the fully
|
The macro should be used at global scope, and `struct_name` should be the fully
|
||||||
namespace qualified name of the struct to be adapted.
|
namespace qualified name of the struct to be adapted.
|
||||||
@ -355,7 +355,7 @@ adapted using the given name.
|
|||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
// When BOOST_PP_VARIADICS is missing :
|
// Without BOOST_PP_VARIADICS support :
|
||||||
|
|
||||||
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
||||||
struct_name, adapted_name,
|
struct_name, adapted_name,
|
||||||
@ -393,8 +393,8 @@ 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
|
pairs declares the type and names of each of the struct members that are part of
|
||||||
the sequence.
|
the sequence.
|
||||||
|
|
||||||
Omitting the type or using BOOST_FUSION_ADAPT_AUTO can be used to infer the type,
|
When member_typeN is omitted or set to BOOST_FUSION_ADAPT_AUTO, the type is
|
||||||
as with decltype.
|
infered with Boost.TypeOf.
|
||||||
|
|
||||||
The macros should be used at global scope, and `struct_name` should be the fully
|
The macros should be used at global scope, and `struct_name` should be the fully
|
||||||
namespace qualified name of the struct to be converted.
|
namespace qualified name of the struct to be converted.
|
||||||
@ -421,7 +421,7 @@ namespace qualified name of the struct to be converted.
|
|||||||
name,
|
name,
|
||||||
age)
|
age)
|
||||||
|
|
||||||
// When BOOST_PP_VARIADICS is missing :
|
// Without BOOST_PP_VARIADICS support :
|
||||||
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
BOOST_FUSION_ADAPT_STRUCT_NAMED(
|
||||||
demo::employee, adapted_employee,
|
demo::employee, adapted_employee,
|
||||||
(BOOST_FUSION_ADAPT_AUTO, name),
|
(BOOST_FUSION_ADAPT_AUTO, name),
|
||||||
@ -439,8 +439,8 @@ __random_access_sequence__ and __associative_sequence__.
|
|||||||
[heading Synopsis]
|
[heading Synopsis]
|
||||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
||||||
struct_name,
|
struct_name,
|
||||||
(member_type0, member_name0, key_type0)
|
([member_type0,] member_name0, key_type0)
|
||||||
(member_type1, member_name1, key_type1)
|
([member_type1,] member_name1, key_type1)
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -448,10 +448,13 @@ __random_access_sequence__ and __associative_sequence__.
|
|||||||
|
|
||||||
The above macro generates the necessary code to adapt `struct_name`
|
The above macro generates the necessary code to adapt `struct_name`
|
||||||
as a model of __random_access_sequence__ and __associative_sequence__.
|
as a model of __random_access_sequence__ and __associative_sequence__.
|
||||||
The sequence of `(member_typeN, member_nameN, key_typeN)`
|
The sequence of `([member_typeN,] member_nameN, key_typeN)` tuples
|
||||||
triples declares the type, name and key type of each of the struct members
|
declares the type, name and key type of each of the struct members
|
||||||
that are part of the sequence.
|
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
|
The macro should be used at global scope, and `struct_name` should be the fully
|
||||||
namespace qualified name of the struct to be adapted.
|
namespace qualified name of the struct to be adapted.
|
||||||
|
|
||||||
@ -481,8 +484,14 @@ namespace qualified name of the struct to be adapted.
|
|||||||
// keys keys::name and keys::age present.
|
// keys keys::name and keys::age present.
|
||||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
BOOST_FUSION_ADAPT_ASSOC_STRUCT(
|
||||||
demo::employee,
|
demo::employee,
|
||||||
(std::string, name, keys::name)
|
(name, keys::name)
|
||||||
(int, age, keys::age))
|
(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]
|
[endsect]
|
||||||
|
|
||||||
@ -497,8 +506,8 @@ __random_access_sequence__ and __associative_sequence__.
|
|||||||
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
|
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
|
||||||
(template_param0)(template_param1)...,
|
(template_param0)(template_param1)...,
|
||||||
(struct_name) (specialization_param0)(specialization_param1)...,
|
(struct_name) (specialization_param0)(specialization_param1)...,
|
||||||
(member_type0, member_name0, key_type0)
|
([member_type0,] member_name0, key_type0)
|
||||||
(member_type1, member_name1, key_type1)
|
([member_type1,] member_name1, key_type1)
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -512,10 +521,13 @@ the template type parameters used.
|
|||||||
The sequence `(specialization_param0)(specialization_param1)...`
|
The sequence `(specialization_param0)(specialization_param1)...`
|
||||||
declares the template parameters of the actual specialization of `struct_name`
|
declares the template parameters of the actual specialization of `struct_name`
|
||||||
that is adapted as a fusion sequence.
|
that is adapted as a fusion sequence.
|
||||||
The sequence of `(member_typeN, member_nameN, key_typeN)`
|
The sequence of `([member_typeN,] member_nameN, key_typeN)`
|
||||||
triples declares the type, name and key type of each of the struct members
|
tuples declares the type, name and key type of each of the struct members
|
||||||
that are part of the sequence.
|
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
|
The macro should be used at global scope, and `struct_name` should be the fully
|
||||||
namespace qualified name of the struct to be adapted.
|
namespace qualified name of the struct to be adapted.
|
||||||
|
|
||||||
@ -544,6 +556,13 @@ namespace qualified name of the struct to be adapted.
|
|||||||
// Any instantiated demo::employee is now a Fusion sequence.
|
// Any instantiated demo::employee is now a Fusion sequence.
|
||||||
// It is also an associative sequence with
|
// It is also an associative sequence with
|
||||||
// keys keys::name and keys::age present.
|
// 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(
|
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
|
||||||
(Name)(Age),
|
(Name)(Age),
|
||||||
(demo::employee) (Name)(Age),
|
(demo::employee) (Name)(Age),
|
||||||
@ -563,8 +582,8 @@ __associative_sequence__. The given struct is adapted using the given name.
|
|||||||
[heading Synopsis]
|
[heading Synopsis]
|
||||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
|
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
|
||||||
struct_name, adapted_name,
|
struct_name, adapted_name,
|
||||||
(member_type0, member_name0, key_type0)
|
([member_type0,] member_name0, key_type0)
|
||||||
(member_type1, member_name1, key_type1)
|
([member_type1,] member_name1, key_type1)
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -572,8 +591,8 @@ __associative_sequence__. The given struct is adapted using the given name.
|
|||||||
struct_name,
|
struct_name,
|
||||||
(namespace0)(namespace1)...,
|
(namespace0)(namespace1)...,
|
||||||
adapted_name,
|
adapted_name,
|
||||||
(member_type0, member_name0, key_type0)
|
([member_type0,] member_name0, key_type0)
|
||||||
(member_type1, member_name1, key_type1)
|
([member_type1,] member_name1, key_type1)
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -593,6 +612,9 @@ The sequence of `(member_typeN, member_nameN, key_typeN)`
|
|||||||
triples declares the type, name and key type of each of the struct members
|
triples declares the type, name and key type of each of the struct members
|
||||||
that are part of the sequence.
|
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
|
The macros should be used at global scope, and `struct_name` should be the fully
|
||||||
namespace qualified name of the struct to be converted.
|
namespace qualified name of the struct to be converted.
|
||||||
|
|
||||||
@ -621,8 +643,14 @@ namespace qualified name of the struct to be converted.
|
|||||||
// referring to demo::employee
|
// referring to demo::employee
|
||||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
|
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
|
||||||
demo::employee, adapted_employee,
|
demo::employee, adapted_employee,
|
||||||
(std::string, name, keys::name)
|
(name, keys::name)
|
||||||
(int, age, keys::age))
|
(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]
|
[endsect]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user