From f1994724589fbcef2d60da9b785c982d266aebba Mon Sep 17 00:00:00 2001
From: Joel de Guzman
Date: Thu, 20 Dec 2007 23:28:26 +0000
Subject: [PATCH] Removing fusion variant adapter
[SVN r42224]
---
doc/adapted.qbk | 115 +++++++++++++---
doc/changelog.qbk | 15 ++-
doc/extension.qbk | 119 +---------------
doc/html/fusion/adapted.html | 9 +-
doc/html/fusion/adapted/adapt_assoc.html | 123 +++++++++++++++++
doc/html/fusion/adapted/adapt_struct.html | 110 +++++++++++++++
doc/html/fusion/adapted/boost__array.html | 8 +-
doc/html/fusion/adapted/boost__tuple.html | 14 +-
doc/html/fusion/adapted/boost__variant.html | 84 ------------
doc/html/fusion/adapted/mpl_sequence.html | 8 +-
doc/html/fusion/adapted/std__pair.html | 8 +-
doc/html/fusion/algorithm.html | 12 +-
doc/html/fusion/algorithm/iteration.html | 2 +-
.../iteration/functions/accumulate.html | 14 +-
.../algorithm/iteration/functions/fold.html | 14 +-
.../iteration/functions/for_each.html | 14 +-
.../iteration/metafunctions/accumulate.html | 12 +-
.../iteration/metafunctions/fold.html | 12 +-
.../iteration/metafunctions/for_each.html | 12 +-
doc/html/fusion/algorithm/query.html | 2 +-
.../fusion/algorithm/query/functions/all.html | 14 +-
.../fusion/algorithm/query/functions/any.html | 14 +-
.../algorithm/query/functions/count.html | 14 +-
.../algorithm/query/functions/count_if.html | 14 +-
.../algorithm/query/functions/find.html | 14 +-
.../algorithm/query/functions/find_if.html | 12 +-
.../algorithm/query/functions/none.html | 14 +-
.../algorithm/query/metafunctions/all.html | 12 +-
.../algorithm/query/metafunctions/any.html | 12 +-
.../algorithm/query/metafunctions/count.html | 12 +-
.../query/metafunctions/count_if.html | 12 +-
.../algorithm/query/metafunctions/find.html | 12 +-
.../query/metafunctions/find_if.html | 12 +-
.../algorithm/query/metafunctions/none.html | 12 +-
doc/html/fusion/algorithm/transformation.html | 2 +-
.../transformation/functions/clear.html | 14 +-
.../transformation/functions/erase.html | 14 +-
.../transformation/functions/erase_key.html | 14 +-
.../transformation/functions/filter.html | 14 +-
.../transformation/functions/filter_if.html | 14 +-
.../transformation/functions/insert.html | 14 +-
.../functions/insert_range.html | 14 +-
.../transformation/functions/join.html | 14 +-
.../transformation/functions/pop_back.html | 14 +-
.../transformation/functions/pop_front.html | 14 +-
.../transformation/functions/push_back.html | 14 +-
.../transformation/functions/push_front.html | 14 +-
.../transformation/functions/remove.html | 14 +-
.../transformation/functions/remove_if.html | 14 +-
.../transformation/functions/replace.html | 14 +-
.../transformation/functions/replace_if.html | 14 +-
.../transformation/functions/reverse.html | 14 +-
.../transformation/functions/transform.html | 18 +--
.../transformation/functions/zip.html | 14 +-
.../transformation/metafunctions/clear.html | 12 +-
.../transformation/metafunctions/erase.html | 12 +-
.../metafunctions/erase_key.html | 12 +-
.../transformation/metafunctions/filter.html | 12 +-
.../metafunctions/filter_if.html | 12 +-
.../transformation/metafunctions/insert.html | 12 +-
.../metafunctions/insert_range.html | 12 +-
.../transformation/metafunctions/join.html | 10 +-
.../metafunctions/pop_back.html | 12 +-
.../metafunctions/pop_front.html | 10 +-
.../metafunctions/push_back.html | 10 +-
.../metafunctions/push_front.html | 10 +-
.../transformation/metafunctions/remove.html | 12 +-
.../metafunctions/remove_if.html | 12 +-
.../transformation/metafunctions/replace.html | 12 +-
.../metafunctions/replace_if.html | 12 +-
.../transformation/metafunctions/reverse.html | 12 +-
.../metafunctions/transform.html | 18 +--
.../transformation/metafunctions/zip.html | 10 +-
doc/html/fusion/change_log.html | 21 ++-
doc/html/fusion/extension.html | 5 -
doc/html/fusion/extension/ext_full.html | 16 +--
.../fusion/extension/iterator_facade.html | 22 +--
.../fusion/extension/macros/adapt_assoc.html | 127 ------------------
.../fusion/extension/macros/adapt_struct.html | 113 ----------------
.../fusion/extension/sequence_facade.html | 16 +--
doc/html/fusion/functional.html | 12 +-
.../fusion/functional/adapters/fused.html | 14 +-
.../adapters/fused_function_object.html | 14 +-
.../functional/adapters/fused_procedure.html | 14 +-
.../functional/adapters/unfused_generic.html | 14 +-
.../adapters/unfused_lvalue_args.html | 14 +-
.../adapters/unfused_rvalue_args.html | 14 +-
.../functional/adapters/unfused_typed.html | 14 +-
.../fusion/functional/concepts/callable.html | 6 +-
.../functional/concepts/def_callable.html | 10 +-
doc/html/fusion/functional/concepts/poly.html | 10 +-
.../functional/concepts/reg_callable.html | 10 +-
.../generation/functions/mk_fused.html | 14 +-
.../generation/functions/mk_fused_fobj.html | 14 +-
.../generation/functions/mk_fused_proc.html | 14 +-
.../functions/mk_unfused_genrc.html | 14 +-
.../functions/mk_unfused_lvargs.html | 14 +-
.../functions/mk_unfused_rvargs.html | 14 +-
.../generation/metafunctions/mk_fused.html | 8 +-
.../metafunctions/mk_fused_fobj.html | 8 +-
.../metafunctions/mk_fused_proc.html | 8 +-
.../metafunctions/mk_unfused_genrc.html | 8 +-
.../metafunctions/mk_unfused_lvargs.html | 8 +-
.../metafunctions/mk_unfused_rvargs.html | 8 +-
.../invocation/functions/invoke.html | 12 +-
.../invocation/functions/invoke_fobj.html | 12 +-
.../invocation/functions/invoke_proc.html | 12 +-
.../invocation/metafunctions/invoke.html | 6 +-
.../invocation/metafunctions/invoke_fobj.html | 6 +-
.../invocation/metafunctions/invoke_proc.html | 6 +-
doc/html/fusion/notes.html | 16 +--
.../fusion/tuple/class_template_tuple.html | 2 +-
.../class_template_tuple/construction.html | 4 +-
.../class_template_tuple/element_access.html | 4 +-
.../relational_operators.html | 4 +-
.../tuple_creation_functions.html | 4 +-
.../tuple_helper_classes.html | 4 +-
doc/html/fusion/tuple/pairs.html | 4 +-
doc/html/index.html | 10 +-
test/Jamfile | 1 -
test/sequence/variant.cpp | 56 --------
todo.txt | 7 +
122 files changed, 997 insertions(+), 1154 deletions(-)
create mode 100644 doc/html/fusion/adapted/adapt_assoc.html
create mode 100644 doc/html/fusion/adapted/adapt_struct.html
delete mode 100644 doc/html/fusion/adapted/boost__variant.html
delete mode 100644 doc/html/fusion/extension/macros/adapt_assoc.html
delete mode 100644 doc/html/fusion/extension/macros/adapt_struct.html
delete mode 100644 test/sequence/variant.cpp
diff --git a/doc/adapted.qbk b/doc/adapted.qbk
index 3645fcc9..991918c9 100644
--- a/doc/adapted.qbk
+++ b/doc/adapted.qbk
@@ -16,6 +16,9 @@ they will be regarded as first-class, fully conforming fusion sequences
sequences (see __intrinsics__). That way, we can have 2-way adaptation to
and from __mpl__ and Fusion].
+Fusion also provides various schemes to make it easy for the user to adapt
+various data structures, non-intrusively, as full fledged Fusion sequences.
+
[heading Header]
#include
@@ -136,32 +139,108 @@ __boost_tuple_library__
[endsect]
-[section boost::variant]
-This module provides adapters for `boost::variant`. Including the module
-header makes `boost::variant` a fully conforming __forward_sequence__.
-The variant acts as a sequence of the types that can be contained in the variant.
-Accessing types not currently stored int the variant will lead to the variant
-being populated with a default constructed value of that type.
+[section:adapt_struct BOOST_FUSION_ADAPT_STRUCT]
+
+[heading Description]
+BOOST_FUSION_ADAPT_STRUCT is a macro that can be used to generate all the
+necessary boilerplate to make an arbitrary struct into a __random_access_sequence__.
+
+[heading Synopsis]
+ BOOST_FUSION_ADAPT_STRUCT(
+ struct_name
+ (member_type0, member_name0)
+ (member_type1, member_name1)
+ ...
+ )
+
+[heading Semantics]
+
+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 declare the type and names of each of the struct members that will be
+part of the sequence.
+
+The macro should be used at global scope, and `struct_name` should be the fully
+namespace qualified name of the struct to be converted.
[heading Header]
- #include
- #include
-
-[heading Model of]
-
-* __forward_sequence__
+ #include
+ #include
[heading Example]
+ namespace demo
+ {
+ struct employee
+ {
+ std::string name;
+ int age;
+ };
+ }
- boost::variant example_variant = 101;
- std::cout << example_variant << '\n';
- *boost::fusion::find(example_variant) = "hello";
- std::cout << example_variant << '\n';
+ // demo::employee is now a Fusion sequence
+ BOOST_FUSION_ADAPT_STRUCT(
+ demo::employee
+ (std::string, name)
+ (int, age))
-[heading See also]
+[endsect]
+
+[section:adapt_assoc BOOST_FUSION_ADAPT_ASSOC_STRUCT]
+
+[heading Description]
+BOOST_FUSION_ADAPT_ASSOC_STRUCT is a macro that can be used to generate all the
+necessary boilerplate to make an arbitrary struct into a model of __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)
+ ...
+ )
+
+[heading Semantics]
+
+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 declare the type, name and key type of each of the struct members
+that will be part of the sequence.
+
+The macro should be used at global scope, and `struct_name` should be the fully
+namespace qualified name of the struct to be converted.
+
+[heading Header]
+
+ #include
+ #include
+
+[heading Example]
+ namespace demo
+ {
+ struct employee
+ {
+ std::string name;
+ int age;
+ };
+ }
+
+ namespace keys
+ {
+ struct name;
+ struct age;
+ }
+
+ // 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_STRUCT(
+ demo::employee
+ (std::string, name, keys::name)
+ (int, age, keys::age))
-__boost_variant_library__
[endsect]
diff --git a/doc/changelog.qbk b/doc/changelog.qbk
index c7da9f07..d3e953ce 100644
--- a/doc/changelog.qbk
+++ b/doc/changelog.qbk
@@ -9,8 +9,17 @@
This section summarizes significant changes to the Fusion library.
-* Sep 27, 2006: Added `boost::tuple` support.
-* Nov 17, 2006: Added `boost::variant` support.
-* Feb 15, 2007: Added functional module.
+* Sep 27, 2006: Added `boost::tuple` support. (Joel de Guzman)
+* Nov 17, 2006: Added `boost::variant` support. (Joel de Guzman)
+* Feb 15, 2007: Added functional module. (Tobias Schwinger)
+* APRIL 2, 2007: Added struct adapter. (Joel de Guzman)
+* May 8, 2007: Added associative struct adapter. (Dan Marsden)
+* Dec 20, 2007: Removed `boost::variant` support. After thorough
+ investigation, I think now that the move to make variant a
+ fusion sequence is rather quirky. A variant will always
+ have a size==1 regardless of the number of types it can contain
+ and there's no way to know at compile time what it contains.
+ Iterating over its types is simply wrong. All these imply that
+ the variant is *not* a fusion sequence. (Joel de Guzman)
[endsect]
diff --git a/doc/extension.qbk b/doc/extension.qbk
index c10dc273..b840259f 100644
--- a/doc/extension.qbk
+++ b/doc/extension.qbk
@@ -426,7 +426,7 @@ The user must the implement the key expressions required by their sequence type.
#include
[heading Example]
-A full worked example using __sequence_facade__ is provided in triple.cpp in the extension examples.
+A full working example using __sequence_facade__ is provided in triple.cpp in the extension examples.
[endsect]
@@ -475,122 +475,7 @@ The user must the implement the key expressions required by their iterator type.
#include
[heading Example]
-A full worked example using __iterator_facade__ is provided in triple.cpp in the extension examples.
-
-[endsect]
-
-[section Macros]
-
-[section:adapt_struct BOOST_FUSION_ADAPT_STRUCT]
-
-[heading Description]
-BOOST_FUSION_ADAPT_STRUCT is a macro that can be used to generate all the
-necessary boilerplate to make an arbitrary struct into a __random_access_sequence__.
-
-[heading Synopsis]
- BOOST_FUSION_ADAPT_STRUCT(
- struct_name
- (member_type0, member_name0)
- (member_type1, member_name1)
- ...
- )
-
-[heading Semantics]
- BOOST_FUSION_ADAPT_STRUCT(
- struct_name,
- (member_type0, member_name0)
- (member_type1, member_name1)
- ...
- )
-
-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 declare the type and names of each of the struct members that will be
-part of the sequence.
-
-The macro should be used at global scope, and `struct_name` should be the fully
-namespace qualified name of the struct to be converted.
-
-/adapted/struct/adapt_struct.hpp>
-
-[heading Example]
- namespace demo
- {
- struct employee
- {
- std::string name;
- int age;
- };
- }
-
- // demo::employee is now a Fusion sequence
- BOOST_FUSION_ADAPT_STRUCT(
- demo::employee
- (std::string, name)
- (int, age))
-
-[endsect]
-
-[section:adapt_assoc BOOST_FUSION_ADAPT_ASSOC_STRUCT]
-
-[heading Description]
-BOOST_FUSION_ADAPT_ASSOC_STRUCT is a macro that can be used to generate all the
-necessary boilerplate to make an arbitrary struct into a model of __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)
- ...
- )
-
-[heading Semantics]
- BOOST_FUSION_ADAPT_ASSOC_STRUCT(
- struct_name
- (member_type0, member_name0, key_type0)
- (member_type1, member_name1, key_type1)
- ...
- )
-
-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 declare the type, name and key type of each of the struct members
-that will be part of the sequence.
-
-The macro should be used at global scope, and `struct_name` should be the fully
-namespace qualified name of the struct to be converted.
-
-/adapted/struct/adapt_assoc_struct.hpp>
-
-[heading Example]
- namespace demo
- {
- struct employee
- {
- std::string name;
- int age;
- };
- }
-
- namespace keys
- {
- struct name;
- struct age;
- }
-
- // 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_STRUCT(
- demo::employee
- (std::string, name, keys::name)
- (int, age, keys::age))
-
-
-[endsect]
+A full working example using __iterator_facade__ is provided in triple.cpp in the extension examples.
[endsect]
diff --git a/doc/html/fusion/adapted.html b/doc/html/fusion/adapted.html
index 364ff796..2d5c7a20 100644
--- a/doc/html/fusion/adapted.html
+++ b/doc/html/fusion/adapted.html
@@ -30,7 +30,8 @@
Fusion provides a couple of adapters for other sequences such as std::pair,
@@ -42,8 +43,12 @@
[13]
.
+
+ Fusion also provides various schemes to make it easy for the user to adapt
+ various data structures, non-intrusively, as full fledged Fusion sequences.
+
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT is a macro that can be used to generate all
+ the necessary boilerplate to make an arbitrary struct into a model of 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 declare the type, name and key type of each of the struct members
+ that will be part of the sequence.
+
+
+ The macro should be used at global scope, and struct_name
+ should be the fully namespace qualified name of the struct to be converted.
+
+ BOOST_FUSION_ADAPT_STRUCT is a macro that can be used to generate all the
+ necessary boilerplate to make an arbitrary struct into a 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 declare the type and names of each of the struct members that will
+ be part of the sequence.
+
+
+ The macro should be used at global scope, and struct_name
+ should be the fully namespace qualified name of the struct to be converted.
+