diff --git a/doc/adapted.qbk b/doc/adapted.qbk
index 7b4324f9..de658573 100644
--- a/doc/adapted.qbk
+++ b/doc/adapted.qbk
@@ -548,9 +548,105 @@ namespace qualified name of the struct to be converted.
[endsect]
-[section:define_struct BOOST_FUSION_DEFINE_STRUCT]
+[section:adapt_adt BOOST_FUSION_ADAPT_ADT]
-[heading Description]
+BOOST_FUSION_ADAPT_ADT is a macro than can be used to generate all the
+necessary boilerplate to adapt an arbitrary class type as a model of
+__random_access_sequence__.
+
+[heading Synopsis]
+
+ BOOST_FUSION_ADAPT_ADT(
+ type_name,
+ (attribute_type0, attribute_const_type0, get_expr0, set_expr0)
+ (attribute_type1, attribute_const_type1, get_expr1, set_expr1)
+ ...
+ )
+
+[heading Expression Semantics]
+
+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])]
+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
+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.
+[^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
+`type_name`, and `val` of an arbitrary const-qualified reference template type
+parameter `Val`, which represents the right operand of the assignment
+expression.
+
+The actual return type of fusion's intrinsic sequence access (meta-)functions
+when in invoked with (an instance of) `type_name` is a proxy type.
+This type is implicitly convertible to the attribute type via [^get_expr['N]] and
+forwards assignment to the underlying element via [^set_expr['N]].
+The value type (that is the type returned by __result_of_value_of__,
+__result_of_value_at__ and __result_of_value_at_c__) of the ['N]th element
+is [^attribute_type['N]] with const-qualifier and reference removed.
+
+[heading Header]
+
+ #include
#include <boost/fusion/adapted.hpp> diff --git a/doc/html/fusion/adapted/adapt_adt.html b/doc/html/fusion/adapted/adapt_adt.html new file mode 100644 index 00000000..d5bfe8fd --- /dev/null +++ b/doc/html/fusion/adapted/adapt_adt.html @@ -0,0 +1,161 @@ + + + +BOOST_FUSION_ADAPT_ADT + + + + + + + + +
![]() |
+Home | +Libraries | +People | +FAQ | +More | +
+ BOOST_FUSION_ADAPT_ADT is a macro than can be used to generate all the necessary + boilerplate to adapt an arbitrary class type as a model of 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) + ... + ) ++
+ The above macro generates the necessary code to adapt type_name
+ as a model of Random
+ Access Sequence. The sequence of (attribute_typeN,
+ attribute_const_typeN, get_exprN,
+ set_exprN)
quadruples declares the types,
+ const types, get-expressions and set-expressions of the elements that are
+ part of the adapted fusion sequence. get_exprN
+ is the expression that is invoked to get the Nth element
+ 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_typeN
+ and attribute_const_typeN
may specify
+ the types that get_exprN
denotes
+ to. set_exprN
is the expression that
+ is invoked to set the Nth element of an instance of
+ type_name
. This expression
+ may access variables named obj
+ of type type_name&
,
+ which represent the corresponding instance of type_name
,
+ and val
of an arbitrary const-qualified
+ reference template type parameter Val
,
+ which represents the right operand of the assignment expression.
+
+ The actual return type of fusion's intrinsic sequence access (meta-)functions
+ when in invoked with (an instance of) type_name
+ is a proxy type. This type is implicitly convertible to the attribute type
+ via get_exprN
and forwards assignment
+ to the underlying element via set_exprN
.
+ The value type (that is the type returned by result_of::value_of
, result_of::value_at
and result_of::value_at_c
) of the Nth
+ element is attribute_typeN
with const-qualifier
+ and reference removed.
+
#include <boost/fusion/adapted/adt/adapt_adt.hpp> +#include <boost/fusion/include/adapt_adt.hpp> ++
namespace demo +{ + struct employee + { + private: + std::string name; + int age; + + public: + void set_name(std::string const& n) + { + name=n; + } + + void set_age(int a) + { + age=a; + } + + std::string const& get_name()const + { + return name; + } + + int get_age()const + { + return age; + } + }; +} + +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))) + +demo::employee e; +front(e)="Edward Norton"; +back(e)=41; +//Prints 'Edward Norton is 41 years old' +std::cout << e.get_name() << " is " << e.get_age() << "years old" << std::endl; ++
+ | + |
@@ -37,7 +37,7 @@ Sequence.
BOOST_FUSION_ADAPT_ASSOC_STRUCT( @@ -48,7 +48,7 @@ )
@@ -66,14 +66,14 @@ should be the fully namespace qualified name of the struct to be adapted.
#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp> #include <boost/fusion/include/adapt_assoc_struct.hpp>
namespace demo diff --git a/doc/html/fusion/adapted/adapt_assoc_struct_named.html b/doc/html/fusion/adapted/adapt_assoc_struct_named.html index 823db0a6..610c18a6 100644 --- a/doc/html/fusion/adapted/adapt_assoc_struct_named.html +++ b/doc/html/fusion/adapted/adapt_assoc_struct_named.html @@ -7,7 +7,7 @@ - +
@@ -38,7 +38,7 @@ Sequence. The given struct is adapted using the given name.
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED( @@ -58,7 +58,7 @@ )
@@ -83,14 +83,14 @@ should be the fully namespace qualified name of the struct to be converted.
#include <boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp> #include <boost/fusion/include/adapt_assoc_struct_named.hpp>
namespace demo @@ -127,7 +127,7 @@