From 758178a2a8771f38eda94999710935b02e794d19 Mon Sep 17 00:00:00 2001
From: Christopher Schmidt
Date: Fri, 18 Jun 2010 17:23:20 +0000
Subject: [PATCH] added reverse_fold/iter_fold/reverse_iter_fold (2) (fixes
#1623)
[SVN r63083]
---
doc/algorithm.qbk | 194 ++++++-------
doc/changelog.qbk | 2 +
doc/fusion.qbk | 6 +
doc/html/fusion/acknowledgements.html | 2 +-
doc/html/fusion/adapted.html | 4 +-
doc/html/fusion/adapted/adapt_assoc.html | 12 +-
.../adapted/adapt_assoc_struct_named.html | 12 +-
.../adapted/adapt_assoc_tpl_struct.html | 12 +-
doc/html/fusion/adapted/adapt_struct.html | 12 +-
.../fusion/adapted/adapt_struct_named.html | 12 +-
doc/html/fusion/adapted/adapt_tpl_struct.html | 12 +-
doc/html/fusion/adapted/array.html | 8 +-
doc/html/fusion/adapted/boost__array.html | 10 +-
doc/html/fusion/adapted/boost__tuple.html | 10 +-
.../fusion/adapted/define_assoc_struct.html | 12 +-
.../adapted/define_assoc_tpl_struct.html | 12 +-
doc/html/fusion/adapted/define_struct.html | 12 +-
.../fusion/adapted/define_tpl_struct.html | 12 +-
doc/html/fusion/adapted/mpl_sequence.html | 10 +-
doc/html/fusion/adapted/std__pair.html | 10 +-
doc/html/fusion/algorithm.html | 15 +-
doc/html/fusion/algorithm/iteration.html | 4 +-
.../fusion/algorithm/iteration/functions.html | 5 +-
.../iteration/functions/accumulate.html | 268 +++++++++++-------
.../algorithm/iteration/functions/fold.html | 265 ++++++++++-------
.../iteration/functions/for_each.html | 18 +-
.../algorithm/iteration/metafunctions.html | 5 +-
.../iteration/metafunctions/accumulate.html | 223 ++++++++-------
.../iteration/metafunctions/fold.html | 223 ++++++++-------
.../iteration/metafunctions/for_each.html | 14 +-
doc/html/fusion/algorithm/query.html | 4 +-
.../fusion/algorithm/query/functions.html | 2 +-
.../fusion/algorithm/query/functions/all.html | 16 +-
.../fusion/algorithm/query/functions/any.html | 16 +-
.../algorithm/query/functions/count.html | 16 +-
.../algorithm/query/functions/count_if.html | 16 +-
.../algorithm/query/functions/find.html | 16 +-
.../algorithm/query/functions/find_if.html | 14 +-
.../algorithm/query/functions/none.html | 16 +-
.../fusion/algorithm/query/metafunctions.html | 2 +-
.../algorithm/query/metafunctions/all.html | 14 +-
.../algorithm/query/metafunctions/any.html | 14 +-
.../algorithm/query/metafunctions/count.html | 14 +-
.../query/metafunctions/count_if.html | 14 +-
.../algorithm/query/metafunctions/find.html | 14 +-
.../query/metafunctions/find_if.html | 14 +-
.../algorithm/query/metafunctions/none.html | 14 +-
doc/html/fusion/algorithm/transformation.html | 4 +-
.../algorithm/transformation/functions.html | 2 +-
.../transformation/functions/clear.html | 16 +-
.../transformation/functions/erase.html | 16 +-
.../transformation/functions/erase_key.html | 16 +-
.../transformation/functions/filter.html | 16 +-
.../transformation/functions/filter_if.html | 16 +-
.../transformation/functions/insert.html | 16 +-
.../functions/insert_range.html | 16 +-
.../transformation/functions/join.html | 16 +-
.../transformation/functions/pop_back.html | 16 +-
.../transformation/functions/pop_front.html | 16 +-
.../transformation/functions/push_back.html | 16 +-
.../transformation/functions/push_front.html | 16 +-
.../transformation/functions/remove.html | 16 +-
.../transformation/functions/remove_if.html | 16 +-
.../transformation/functions/replace.html | 16 +-
.../transformation/functions/replace_if.html | 16 +-
.../transformation/functions/reverse.html | 16 +-
.../transformation/functions/transform.html | 20 +-
.../transformation/functions/zip.html | 16 +-
.../transformation/metafunctions.html | 2 +-
.../transformation/metafunctions/clear.html | 14 +-
.../transformation/metafunctions/erase.html | 14 +-
.../metafunctions/erase_key.html | 14 +-
.../transformation/metafunctions/filter.html | 14 +-
.../metafunctions/filter_if.html | 14 +-
.../transformation/metafunctions/insert.html | 14 +-
.../metafunctions/insert_range.html | 14 +-
.../transformation/metafunctions/join.html | 12 +-
.../metafunctions/pop_back.html | 14 +-
.../metafunctions/pop_front.html | 14 +-
.../metafunctions/push_back.html | 14 +-
.../metafunctions/push_front.html | 14 +-
.../transformation/metafunctions/remove.html | 14 +-
.../metafunctions/remove_if.html | 14 +-
.../transformation/metafunctions/replace.html | 14 +-
.../metafunctions/replace_if.html | 14 +-
.../transformation/metafunctions/reverse.html | 14 +-
.../metafunctions/transform.html | 20 +-
.../transformation/metafunctions/zip.html | 12 +-
doc/html/fusion/change_log.html | 6 +-
doc/html/fusion/container.html | 4 +-
doc/html/fusion/container/cons.html | 16 +-
doc/html/fusion/container/conversion.html | 4 +-
.../container/conversion/functions.html | 2 +-
.../conversion/functions/as_list.html | 14 +-
.../conversion/functions/as_map.html | 14 +-
.../conversion/functions/as_set.html | 14 +-
.../conversion/functions/as_vector.html | 14 +-
.../container/conversion/metafunctions.html | 2 +-
.../conversion/metafunctions/as_list.html | 14 +-
.../conversion/metafunctions/as_map.html | 14 +-
.../conversion/metafunctions/as_set.html | 14 +-
.../conversion/metafunctions/as_vector.html | 14 +-
doc/html/fusion/container/generation.html | 4 +-
.../container/generation/functions.html | 2 +-
.../generation/functions/list_tie.html | 14 +-
.../generation/functions/make_cons.html | 16 +-
.../generation/functions/make_list.html | 16 +-
.../generation/functions/make_map.html | 16 +-
.../generation/functions/make_set.html | 16 +-
.../generation/functions/make_vector.html | 16 +-
.../generation/functions/map_tie.html | 14 +-
.../container/generation/functions/tiers.html | 8 +-
.../generation/functions/vector_tie.html | 14 +-
.../container/generation/metafunctions.html | 2 +-
.../generation/metafunctions/list_tie.html | 14 +-
.../generation/metafunctions/make_cons.html | 14 +-
.../generation/metafunctions/make_list.html | 14 +-
.../generation/metafunctions/make_map.html | 16 +-
.../generation/metafunctions/make_set.html | 14 +-
.../generation/metafunctions/make_vector.html | 14 +-
.../generation/metafunctions/map_tie.html | 14 +-
.../generation/metafunctions/vector_tie.html | 14 +-
doc/html/fusion/container/list.html | 16 +-
doc/html/fusion/container/map.html | 16 +-
doc/html/fusion/container/set.html | 16 +-
doc/html/fusion/container/vector.html | 16 +-
doc/html/fusion/extension.html | 2 +-
doc/html/fusion/extension/ext_full.html | 18 +-
.../fusion/extension/iterator_facade.html | 16 +-
.../fusion/extension/sequence_facade.html | 16 +-
doc/html/fusion/functional.html | 10 +-
doc/html/fusion/functional/adapters.html | 2 +-
.../fusion/functional/adapters/fused.html | 18 +-
.../adapters/fused_function_object.html | 18 +-
.../functional/adapters/fused_procedure.html | 18 +-
.../fusion/functional/adapters/limits.html | 6 +-
.../fusion/functional/adapters/unfused.html | 18 +-
.../functional/adapters/unfused_typed.html | 18 +-
doc/html/fusion/functional/concepts.html | 2 +-
.../fusion/functional/concepts/callable.html | 8 +-
.../functional/concepts/def_callable.html | 12 +-
doc/html/fusion/functional/concepts/poly.html | 12 +-
.../functional/concepts/reg_callable.html | 12 +-
doc/html/fusion/functional/generation.html | 2 +-
.../functional/generation/functions.html | 2 +-
.../generation/functions/mk_fused.html | 16 +-
.../generation/functions/mk_fused_fobj.html | 16 +-
.../generation/functions/mk_fused_proc.html | 16 +-
.../generation/functions/mk_unfused.html | 16 +-
.../functional/generation/metafunctions.html | 2 +-
.../generation/metafunctions/mk_fused.html | 10 +-
.../metafunctions/mk_fused_fobj.html | 10 +-
.../metafunctions/mk_fused_proc.html | 10 +-
.../generation/metafunctions/mk_unfused.html | 10 +-
doc/html/fusion/functional/invocation.html | 2 +-
.../functional/invocation/functions.html | 2 +-
.../invocation/functions/invoke.html | 16 +-
.../invocation/functions/invoke_fobj.html | 16 +-
.../invocation/functions/invoke_proc.html | 16 +-
.../fusion/functional/invocation/limits.html | 6 +-
.../functional/invocation/metafunctions.html | 2 +-
.../invocation/metafunctions/invoke.html | 8 +-
.../invocation/metafunctions/invoke_fobj.html | 8 +-
.../invocation/metafunctions/invoke_proc.html | 8 +-
doc/html/fusion/introduction.html | 6 +-
doc/html/fusion/iterator.html | 4 +-
doc/html/fusion/iterator/concepts.html | 2 +-
.../concepts/associative_iterator.html | 12 +-
.../concepts/bidirectional_iterator.html | 16 +-
.../iterator/concepts/forward_iterator.html | 14 +-
.../concepts/random_access_iterator.html | 12 +-
doc/html/fusion/iterator/functions.html | 2 +-
.../fusion/iterator/functions/advance.html | 14 +-
.../fusion/iterator/functions/advance_c.html | 14 +-
doc/html/fusion/iterator/functions/deref.html | 14 +-
.../fusion/iterator/functions/deref_data.html | 14 +-
.../fusion/iterator/functions/distance.html | 14 +-
doc/html/fusion/iterator/functions/next.html | 14 +-
doc/html/fusion/iterator/functions/prior.html | 14 +-
doc/html/fusion/iterator/metafunctions.html | 2 +-
.../iterator/metafunctions/advance.html | 14 +-
.../iterator/metafunctions/advance_c.html | 14 +-
.../fusion/iterator/metafunctions/deref.html | 14 +-
.../iterator/metafunctions/deref_data.html | 14 +-
.../iterator/metafunctions/distance.html | 14 +-
.../iterator/metafunctions/equal_to.html | 14 +-
.../fusion/iterator/metafunctions/key_of.html | 14 +-
.../fusion/iterator/metafunctions/next.html | 14 +-
.../fusion/iterator/metafunctions/prior.html | 14 +-
.../iterator/metafunctions/value_of.html | 14 +-
.../iterator/metafunctions/value_of_data.html | 14 +-
doc/html/fusion/iterator/operator.html | 2 +-
.../iterator/operator/operator_equality.html | 12 +-
.../operator/operator_inequality.html | 12 +-
.../operator/operator_unary_star.html | 14 +-
doc/html/fusion/notes.html | 18 +-
doc/html/fusion/organization.html | 12 +-
doc/html/fusion/preface.html | 12 +-
doc/html/fusion/quick_start.html | 18 +-
doc/html/fusion/references.html | 2 +-
doc/html/fusion/sequence.html | 4 +-
doc/html/fusion/sequence/concepts.html | 6 +-
.../concepts/associative_sequence.html | 12 +-
.../concepts/bidirectional_sequence.html | 14 +-
.../sequence/concepts/forward_sequence.html | 14 +-
.../concepts/random_access_sequence.html | 14 +-
doc/html/fusion/sequence/intrinsic.html | 8 +-
.../fusion/sequence/intrinsic/functions.html | 2 +-
.../sequence/intrinsic/functions/at.html | 14 +-
.../sequence/intrinsic/functions/at_c.html | 14 +-
.../sequence/intrinsic/functions/at_key.html | 14 +-
.../sequence/intrinsic/functions/back.html | 14 +-
.../sequence/intrinsic/functions/begin.html | 14 +-
.../sequence/intrinsic/functions/empty.html | 14 +-
.../sequence/intrinsic/functions/end.html | 14 +-
.../sequence/intrinsic/functions/front.html | 14 +-
.../sequence/intrinsic/functions/has_key.html | 14 +-
.../sequence/intrinsic/functions/size.html | 14 +-
.../sequence/intrinsic/functions/swap.html | 12 +-
.../sequence/intrinsic/metafunctions.html | 2 +-
.../sequence/intrinsic/metafunctions/at.html | 18 +-
.../intrinsic/metafunctions/at_c.html | 18 +-
.../intrinsic/metafunctions/at_key.html | 18 +-
.../intrinsic/metafunctions/back.html | 14 +-
.../intrinsic/metafunctions/begin.html | 14 +-
.../intrinsic/metafunctions/empty.html | 14 +-
.../sequence/intrinsic/metafunctions/end.html | 14 +-
.../intrinsic/metafunctions/front.html | 14 +-
.../intrinsic/metafunctions/has_key.html | 14 +-
.../intrinsic/metafunctions/size.html | 14 +-
.../intrinsic/metafunctions/swap.html | 12 +-
.../intrinsic/metafunctions/value_at.html | 14 +-
.../intrinsic/metafunctions/value_at_c.html | 14 +-
.../intrinsic/metafunctions/value_at_key.html | 14 +-
doc/html/fusion/sequence/operator.html | 2 +-
.../fusion/sequence/operator/comparison.html | 4 +-
.../sequence/operator/comparison/equal.html | 14 +-
.../operator/comparison/greater_than.html | 12 +-
.../comparison/greater_than_equal.html | 12 +-
.../operator/comparison/less_than.html | 12 +-
.../operator/comparison/less_than_equal.html | 12 +-
.../operator/comparison/not_equal.html | 12 +-
doc/html/fusion/sequence/operator/i_o.html | 4 +-
doc/html/fusion/sequence/operator/i_o/in.html | 14 +-
.../fusion/sequence/operator/i_o/out.html | 14 +-
doc/html/fusion/support.html | 2 +-
doc/html/fusion/support/category_of.html | 14 +-
doc/html/fusion/support/deduce.html | 12 +-
doc/html/fusion/support/deduce_sequence.html | 12 +-
doc/html/fusion/support/is_sequence.html | 14 +-
doc/html/fusion/support/is_view.html | 14 +-
doc/html/fusion/support/pair.html | 14 +-
doc/html/fusion/support/tag_of.html | 14 +-
doc/html/fusion/tuple.html | 2 +-
.../fusion/tuple/class_template_tuple.html | 4 +-
.../class_template_tuple/construction.html | 6 +-
.../class_template_tuple/element_access.html | 6 +-
.../relational_operators.html | 6 +-
.../tuple_creation_functions.html | 6 +-
.../tuple_helper_classes.html | 6 +-
doc/html/fusion/tuple/pairs.html | 6 +-
doc/html/fusion/view.html | 4 +-
doc/html/fusion/view/filter_view.html | 16 +-
doc/html/fusion/view/iterator_range.html | 16 +-
doc/html/fusion/view/joint_view.html | 16 +-
doc/html/fusion/view/nview.html | 16 +-
doc/html/fusion/view/reverse_view.html | 14 +-
doc/html/fusion/view/single_view.html | 14 +-
doc/html/fusion/view/transform_view.html | 14 +-
doc/html/fusion/view/zip_view.html | 16 +-
doc/html/index.html | 6 +-
.../fusion/algorithm/iteration/accumulate.hpp | 4 +-
272 files changed, 2233 insertions(+), 2089 deletions(-)
diff --git a/doc/algorithm.qbk b/doc/algorithm.qbk
index 3fa194b2..e77249d3 100644
--- a/doc/algorithm.qbk
+++ b/doc/algorithm.qbk
@@ -35,9 +35,7 @@ algorithm simply returns a __joint_view__: a view that holds a reference to
the original sequence `s` and the value `x`. Functions that were once
sequence specific and need to be implemented N times over N different
sequences are now implemented only once. That is to say that Fusion
-sequences are cheaply extensible. However, an important caveat is that the
-result of a sequence extending operation like __push_back__ does not retain
-the properties of the original sequence such as associativity of __set__(s).
+sequences are cheaply extensible.
To regain the original sequence, __conversion__ functions are provided. You
may use one of the __conversion__ functions to convert back to the original
sequence type.
@@ -59,42 +57,59 @@ a sequence repeatedly applying an operation to its elements.
[section Functions]
-[section fold]
-
+[template fold_desc[name result_of_name arg_desc arg_id arg_type_id invoke_desc semantics_elements_desc example_arg_transform example_result I0 I1 IN]
[heading Description]
-For a sequence `seq`, initial state `initial_state`, and binary function object or function pointer `f`, fold returns the result of the repeated application of binary `f` to the result of the previous `f` invocation (`inital_state` if it is the first call) and each element of `seq`.
+For a sequence `seq`, initial state `initial_state`, and binary function object
+or function pointer `f`, [^[name]] returns the result of the repeated application of
+binary `f` to the result of the previous `f` invocation (`inital_state` if it is
+the first call) and [arg_desc] of `seq`.
+[def name_macro [name]]
+[def result_of_name_macro [result_of_name]]
[heading Synopsis]
template<
typename Sequence,
typename State,
typename F
>
- typename __result_of_fold__::type fold(
- Sequence& seq, State const& initial_state, F const& f);
+ typename result_of_name_macro::type name_macro(
+ Sequence& seq, State const& initial_state, F f);
+
+ template<
+ typename Sequence,
+ typename State,
+ typename F
+ >
+ typename result_of_name_macro::type name_macro(
+ Sequence const& seq, State const& initial_state, F f);
+[def arg_type_id_macro [arg_type_id]]
+[def arg_id_macro [arg_id]]
+[def invoke_desc_macro [invoke_desc]]
[table Parameters
[[Parameter][Requirement][Description]]
- [[`seq`][A model of __forward_sequence__, `f(s,e)` must be a valid expression for current state `s`, and each element `e` in `seq`][Operation's argument]]
+ [[`seq`][A model of __forward_sequence__][Operation's argument]]
[[`initial_state`][Any type][Initial state]]
- [[`f`][`__boost_result_of_call__::type` is the return type of `f(s,e)` current state `s` of type `S`, and for each element `e` of type `E` in `seq`][Operation's argument]]
+ [[`f`][`f(s,arg_id_macro)` with return type `__boost_result_of_call__::type` must be a valid expression for current state `s` of type `S`, and for each invoke_desc_macro][Operation's argument]]
]
[heading Expression Semantics]
- fold(seq, initial_state, f);
+ name_macro(seq, initial_state, f);
[*Return type]: Any type
-[*Semantics]: Equivalent to `f(... f(f(initial_state,e1),e2) ...eN)` where `e1 ...eN` are the elements of `seq`.
+[*Semantics]: Equivalent to [^f(... f(f(initial_state,[arg_id][I0]),[arg_id][I1]) ...[arg_id][IN])] where [^[arg_id]1 ...[arg_id]N] are [semantics_elements_desc].
[heading Complexity]
Linear, exactly `__result_of_size__::value` applications of `f`.
[heading Header]
- #include
- #include
+ #include
+ #include
+[def example_result_macro [example_result]]
+[def example_arg_transform_macro [example_arg_transform]]
[heading Example]
struct make_string
{
@@ -103,66 +118,32 @@ Linear, exactly `__result_of_size__::value` applications of `f`.
template
std::string operator()(const std::string& str, const T& t) const
{
- return str + boost::lexical_cast(t);
+ return str + boost::lexical_cast(example_arg_transform_macro);
}
};
...
const __vector__ vec(1,2);
- assert(__fold__(vec,std::string(""), make_string()) == "12");
+ assert(name_macro(vec,std::string(""), make_string()) == example_result_macro);
+]
+[section fold]
+[fold_desc fold..__result_of_fold__..each element..e..E..element `e` of type `E` in `seq`..the consecutive elements of `seq`..t.."12"..1..2..N]
+[endsect]
+
+[section reverse_fold]
+[fold_desc reverse_fold..__result_of_reverse_fold__..each element..e..E..element `e` of type `E` in `seq`..the consecutive elements of `seq`..t.."21"..N..N-1..1]
+[endsect]
+
+[section iter_fold]
+[fold_desc iter_fold..__result_of_iter_fold__..iterators on each element..it..It..iterator `it` of type `It` on an element of `seq`..consecutive iterators on the elements of `seq`..__deref__(t).."12"..1..2..N]
+[endsect]
+
+[section reverse_iter_fold]
+[fold_desc reverse_iter_fold..__result_of_reverse_iter_fold__..iterators on each element..it..It..iterator `it` of type `It` on an element of `seq`..consecutive iterators on the elements of `seq`..__deref__(t).."21"..N..N-1..1]
[endsect]
[section accumulate]
-
-[heading Description]
-For a sequence `seq`, initial state `initial_state`, and binary function object or function pointer `f`, accumulate returns the result of the repeated application of binary `f` to the result of the previous `f` invocation (`inital_state` if it is the first call) and each element of `seq`.
-
-[heading Synopsis]
- template<
- typename Sequence,
- typename State,
- typename F
- >
- typename __result_of_accumulate__::type accumulate(
- Sequence& seq, State const& initial_state, F const& f);
-
-[table Parameters
- [[Parameter][Requirement][Description]]
- [[`seq`][A model of __forward_sequence__, `f(s,e)` must be a valid expression for current state `s`, and each element `e` in `seq`][Operation's argument]]
- [[`initial_state`][Any type][Initial state]]
- [[`f`][`__boost_result_of_call__::type` is the return type of `f(s,e)` current state `s` of type `S`, and for each element `e` of type `E` in `seq`][Operation's argument]]
-]
-
-[heading Expression Semantics]
- accumulate(seq, initial_state, f);
-
-[*Return type]: Any type
-
-[*Semantics]: Equivalent to `f(... f(f(initial_state,e1),e2) ...eN)` where `e1 ...eN` are the elements of `seq`.
-
-[heading Complexity]
-Linear, exactly `__result_of_size__::value` applications of `f`.
-
-[heading Header]
-
- #include
- #include
-
-[heading Example]
- struct make_string
- {
- typedef std::string result_type;
-
- template
- std::string operator()(const std::string& str, const T& t) const
- {
- return str + boost::lexical_cast(t);
- }
- };
- ...
- const __vector__ vec(1,2);
- assert(__accumulate__(vec,std::string(""), make_string()) == "12");
-
+[fold_desc accumulate..__result_of_accumulate__..each element..e..E..element `e` of type `E` in `seq`..the consecutive elements of `seq`..t.."12"..1..2..N]
[endsect]
[section for_each]
@@ -176,7 +157,7 @@ Applies a unary function object to each element of a sequence.
typename F
>
typename __result_of_for_each__::type for_each(
- Sequence& seq, F const& f);
+ Sequence& seq, F f);
[table Parameters
[[Parameter][Requirement][Description]]
@@ -219,84 +200,67 @@ Linear, exactly `__result_of_size__::value` applications of `f`.
[section Metafunctions]
-[section fold]
-
+[template meta_fold_desc[name name_func arg_id arg_type_id invoke_meta_desc]
[heading Description]
-Returns the result type of __fold__.
+Returns the result type of [name_func].
+[def name_macro [name]]
[heading Synopsis]
template<
typename Sequence,
typename State,
typename F>
- struct fold
+ struct name_macro
{
typedef __unspecified__ type;
};
+[def arg_type_id_macro [arg_type_id]]
+[def arg_id_macro [arg_id]]
+[def invoke_meta_desc_macro [invoke_meta_desc]]
[table Parameters
- [[Parameter] [Requirement] [Description]]
+ [[Parameter] [Requirement] [Description]]
[[`Sequence`] [A model of __forward_sequence__] [The sequence to iterate]]
[[`State`] [Any type] [The initial state for the first application of `F`]]
- [[`F`] [`__boost_result_of_call__::type` is the return type of `f(s,e)` for current state `s` of type `S`, and for each element `e` of type `E` in `seq`] [The operation to be applied on forward traversal]]
+ [[`F`] [`__boost_result_of_call__::type` is the return type of `f(s,arg_id_macro)` with current state `s` of type `S`, and an invoke_meta_desc_macro][The operation to be applied on traversal]]
]
[heading Expression Semantics]
- __result_of_fold__::type
+ name_macro::type
[*Return type]: Any type
-[*Semantics]: Returns the result of applying `fold` to a sequence of type `Sequence`, with an initial state of
-type `State` and binary function object or function pointer of type `F`.
+[*Semantics]: Returns the result of applying [name_func] to a sequence of type
+`Sequence`, with an initial state of type `State` and binary function object or
+function pointer of type `F`.
[heading Complexity]
Linear, exactly `__result_of_size__::value` applications of `F`.
[heading Header]
- #include
- #include
+ #include
+ #include
+]
+[section fold]
+[meta_fold_desc fold..__fold__..e..E..element `e` of type `E` in `seq`]
+[endsect]
+
+[section reverse_fold]
+[meta_fold_desc reverse_fold..__reverse_fold__..e..E..element `e` of type `E` in `seq`]
+[endsect]
+
+[section iter_fold]
+[meta_fold_desc iter_fold..__iter_fold__..it..It..iterator `it` of type `It` on an element of `seq`]
+[endsect]
+
+[section reverse_iter_fold]
+[meta_fold_desc reverse_iter_fold..__reverse_iter_fold__..it..It..iterator `it` of type `It` on an element of `seq`]
[endsect]
[section accumulate]
-
-[heading Description]
-Returns the result type of __accumulate__.
-
-[heading Synopsis]
- template<
- typename Sequence,
- typename State,
- typename F>
- struct accumulate
- {
- typedef __unspecified__ type;
- };
-
-[table Parameters
- [[Parameter] [Requirement] [Description]]
- [[`Sequence`] [A model of __forward_sequence__] [The sequence to iterate]]
- [[`State`] [Any type] [The initial state for the first application of `F`]]
- [[`F`] [`__boost_result_of_call__::type` is the return type of `f(s,e)` for current state `s` of type `S`, and for each element `e` of type `E` in `seq`] [The operation to be applied on forward traversal]]
-]
-
-[heading Expression Semantics]
- __result_of_accumulate__::type
-
-[*Return type]: Any type
-
-[*Semantics]: Returns the result of applying `accumulate` to a sequence of type `Sequence`, with an initial state of
-type `State` and binary function object or function pointer of type `F`.
-
-[heading Complexity]
-Linear, exactly `__result_of_size__::value` applications of `F`.
-
-[heading Header]
-
- #include
- #include
-
+[meta_fold_desc accumulate..__accumulate__..e..E..element `e` of type `E` in `seq`]
[endsect]
[section for_each]
diff --git a/doc/changelog.qbk b/doc/changelog.qbk
index 8a201a1c..ca301a2a 100644
--- a/doc/changelog.qbk
+++ b/doc/changelog.qbk
@@ -32,6 +32,8 @@ This section summarizes significant changes to the Fusion library.
__adapt_assoc_struct_named_ns__ (Christopher Schmidt)
* April 5, 2010: Added __define_struct__, __define_tpl_struct__,
__define_assoc_struct__ and __define_assoc_tpl_struct__ (Christopher Schmidt)
+* June 18, 2010: Added __reverse_fold__, __iter_fold__ and __reverse_iter_fold__
+ (Christopher Schmidt)
[endsect]
diff --git a/doc/fusion.qbk b/doc/fusion.qbk
index 97231b3c..9118c130 100644
--- a/doc/fusion.qbk
+++ b/doc/fusion.qbk
@@ -213,6 +213,12 @@
[def __algorithms__ [link fusion.algorithm Algorithms]]
[def __fold__ [link fusion.algorithm.iteration.functions.fold `fold`]]
[def __result_of_fold__ [link fusion.algorithm.iteration.metafunctions.fold `result_of::fold`]]
+[def __reverse_fold__ [link fusion.algorithm.iteration.functions.reverse_fold `reverse_fold`]]
+[def __result_of_reverse_fold__ [link fusion.algorithm.iteration.metafunctions.reverse_fold `result_of::reverse_fold`]]
+[def __iter_fold__ [link fusion.algorithm.iteration.functions.iter_fold `iter_fold`]]
+[def __result_of_iter_fold__ [link fusion.algorithm.iteration.metafunctions.iter_fold `result_of::iter_fold`]]
+[def __reverse_iter_fold__ [link fusion.algorithm.iteration.functions.reverse_iter_fold `reverse_iter_fold`]]
+[def __result_of_reverse_iter_fold__ [link fusion.algorithm.iteration.metafunctions.reverse_iter_fold `result_of::reverse_iter_fold`]]
[def __accumulate__ [link fusion.algorithm.iteration.functions.accumulate `accumulate`]]
[def __result_of_accumulate__ [link fusion.algorithm.iteration.metafunctions.accumulate `result_of::accumulate`]]
[def __for_each__ [link fusion.algorithm.iteration.functions.for_each `for_each`]]
diff --git a/doc/html/fusion/acknowledgements.html b/doc/html/fusion/acknowledgements.html
index fb86b2fc..844907ad 100644
--- a/doc/html/fusion/acknowledgements.html
+++ b/doc/html/fusion/acknowledgements.html
@@ -3,7 +3,7 @@
Acknowledgements
-
+
diff --git a/doc/html/fusion/adapted.html b/doc/html/fusion/adapted.html
index 8275bce3..5d07b5bf 100644
--- a/doc/html/fusion/adapted.html
+++ b/doc/html/fusion/adapted.html
@@ -3,7 +3,7 @@
Adapted
-
+
@@ -56,7 +56,7 @@
various data structures, non-intrusively, as full fledged Fusion sequences.
#include < boost / fusion / adapted . hpp >
diff --git a/doc/html/fusion/adapted/adapt_assoc.html b/doc/html/fusion/adapted/adapt_assoc.html
index 50007e41..b9968dab 100644
--- a/doc/html/fusion/adapted/adapt_assoc.html
+++ b/doc/html/fusion/adapted/adapt_assoc.html
@@ -3,7 +3,7 @@
BOOST_FUSION_ADAPT_ASSOC_STRUCT
-
+
@@ -27,7 +27,7 @@
BOOST_FUSION_ADAPT_ASSOC_STRUCT
@@ -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 e6d9abdc..2a8996cf 100644
--- a/doc/html/fusion/adapted/adapt_assoc_struct_named.html
+++ b/doc/html/fusion/adapted/adapt_assoc_struct_named.html
@@ -3,7 +3,7 @@
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED
-
+
@@ -27,7 +27,7 @@
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED
@@ -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
diff --git a/doc/html/fusion/adapted/adapt_assoc_tpl_struct.html b/doc/html/fusion/adapted/adapt_assoc_tpl_struct.html
index 29fc1ed5..296ee714 100644
--- a/doc/html/fusion/adapted/adapt_assoc_tpl_struct.html
+++ b/doc/html/fusion/adapted/adapt_assoc_tpl_struct.html
@@ -3,7 +3,7 @@
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT
-
+
@@ -27,7 +27,7 @@
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT
@@ -38,7 +38,7 @@
Sequence.
BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT (
@@ -50,7 +50,7 @@
)
@@ -72,14 +72,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_struct.html b/doc/html/fusion/adapted/adapt_struct.html
index 548a3e22..a1d4e37f 100644
--- a/doc/html/fusion/adapted/adapt_struct.html
+++ b/doc/html/fusion/adapted/adapt_struct.html
@@ -3,7 +3,7 @@
BOOST_FUSION_ADAPT_STRUCT
-
+
@@ -27,7 +27,7 @@
BOOST_FUSION_ADAPT_STRUCT
@@ -36,7 +36,7 @@
Access Sequence.
BOOST_FUSION_ADAPT_STRUCT (
@@ -47,7 +47,7 @@
)
@@ -63,14 +63,14 @@
should be the fully namespace qualified name of the struct to be adapted.
#include < boost / fusion / adapted / struct / adapt_struct . hpp >
#include < boost / fusion / include / adapt_struct . hpp >
namespace demo
diff --git a/doc/html/fusion/adapted/adapt_struct_named.html b/doc/html/fusion/adapted/adapt_struct_named.html
index 87e9657b..9f96e242 100644
--- a/doc/html/fusion/adapted/adapt_struct_named.html
+++ b/doc/html/fusion/adapted/adapt_struct_named.html
@@ -3,7 +3,7 @@
BOOST_FUSION_ADAPT_STRUCT_NAMED
-
+
@@ -27,7 +27,7 @@
BOOST_FUSION_ADAPT_STRUCT_NAMED
@@ -37,7 +37,7 @@
Access Sequence. The given struct is adapted using the given name.
BOOST_FUSION_ADAPT_STRUCT_NAMED (
@@ -57,7 +57,7 @@
)
@@ -81,14 +81,14 @@
should be the fully namespace qualified name of the struct to be converted.
#include < boost / fusion / adapted / struct / adapt_struct_named . hpp >
#include < boost / fusion / include / adapt_struct_named . hpp >
namespace demo
diff --git a/doc/html/fusion/adapted/adapt_tpl_struct.html b/doc/html/fusion/adapted/adapt_tpl_struct.html
index 0445e863..01c916c3 100644
--- a/doc/html/fusion/adapted/adapt_tpl_struct.html
+++ b/doc/html/fusion/adapted/adapt_tpl_struct.html
@@ -3,7 +3,7 @@
BOOST_FUSION_ADAPT_TPL_STRUCT
-
+
@@ -27,7 +27,7 @@
BOOST_FUSION_ADAPT_TPL_STRUCT
@@ -37,7 +37,7 @@
Sequence.
BOOST_FUSION_ADAPT_TPL_STRUCT (
@@ -49,7 +49,7 @@
)
@@ -69,14 +69,14 @@
should be the fully namespace qualified name of the struct to be adapted.
#include < boost / fusion / adapted / struct / adapt_struct . hpp >
#include < boost / fusion / include / adapt_struct . hpp >
namespace demo
diff --git a/doc/html/fusion/adapted/array.html b/doc/html/fusion/adapted/array.html
index c9d2398c..d95c88d5 100644
--- a/doc/html/fusion/adapted/array.html
+++ b/doc/html/fusion/adapted/array.html
@@ -3,7 +3,7 @@
Array
-
+
@@ -32,14 +32,14 @@
Access Sequence.
#include < boost / fusion / adapted / array . hpp >
#include < boost / fusion / include / array . hpp >
@@ -47,7 +47,7 @@
Access Sequence
int arr [ 3 ] = { 1 , 2 , 3 };
diff --git a/doc/html/fusion/adapted/boost__array.html b/doc/html/fusion/adapted/boost__array.html
index abb4ee35..0d1ab2ce 100644
--- a/doc/html/fusion/adapted/boost__array.html
+++ b/doc/html/fusion/adapted/boost__array.html
@@ -3,7 +3,7 @@
boost::array
-
+
@@ -33,14 +33,14 @@
Access Sequence.
#include < boost / fusion / adapted / boost_array . hpp >
#include < boost / fusion / include / boost_array . hpp >
@@ -48,7 +48,7 @@
Access Sequence
boost :: array < int , 3 > arr = {{ 1 , 2 , 3 }};
@@ -60,7 +60,7 @@
std :: cout << at_c
< 2 >( arr ) << std :: endl ;
diff --git a/doc/html/fusion/adapted/boost__tuple.html b/doc/html/fusion/adapted/boost__tuple.html
index 73d831a0..f28859e2 100644
--- a/doc/html/fusion/adapted/boost__tuple.html
+++ b/doc/html/fusion/adapted/boost__tuple.html
@@ -3,7 +3,7 @@
boost::tuple
-
+
@@ -33,21 +33,21 @@
Sequence.
#include < boost / fusion / adapted / boost_tuple . hpp >
#include < boost / fusion / include / boost_tuple . hpp >
boost :: tuple < int , std :: string > example_tuple ( 101 , "hello" );
@@ -55,7 +55,7 @@
std :: cout << * boost :: fusion :: next ( boost :: fusion :: begin ( example_tuple )) << '\n' ;
diff --git a/doc/html/fusion/adapted/define_assoc_struct.html b/doc/html/fusion/adapted/define_assoc_struct.html
index 3392c663..caf565a4 100644
--- a/doc/html/fusion/adapted/define_assoc_struct.html
+++ b/doc/html/fusion/adapted/define_assoc_struct.html
@@ -3,7 +3,7 @@
BOOST_FUSION_DEFINE_ASSOC_STRUCT
-
+
@@ -27,7 +27,7 @@
BOOST_FUSION_DEFINE_ASSOC_STRUCT
@@ -38,7 +38,7 @@
Sequence.
BOOST_FUSION_DEFINE_ASSOC_STRUCT (
@@ -68,7 +68,7 @@
@@ -182,14 +182,14 @@
#include < boost / fusion / adapted / struct / define_assoc_struct . hpp >
#include < boost / fusion / include / define_assoc_struct . hpp >
namespace keys
diff --git a/doc/html/fusion/adapted/define_assoc_tpl_struct.html b/doc/html/fusion/adapted/define_assoc_tpl_struct.html
index e29a4565..3e56a19d 100644
--- a/doc/html/fusion/adapted/define_assoc_tpl_struct.html
+++ b/doc/html/fusion/adapted/define_assoc_tpl_struct.html
@@ -3,7 +3,7 @@
BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT
-
+
@@ -27,7 +27,7 @@
BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT
@@ -38,7 +38,7 @@
Sequence.
BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT (
@@ -73,7 +73,7 @@
@@ -187,14 +187,14 @@
#include < boost / fusion / adapted / struct / define_assoc_struct . hpp >
#include < boost / fusion / include / define_assoc_struct . hpp >
namespace keys
diff --git a/doc/html/fusion/adapted/define_struct.html b/doc/html/fusion/adapted/define_struct.html
index bb7c38d3..bd327f58 100644
--- a/doc/html/fusion/adapted/define_struct.html
+++ b/doc/html/fusion/adapted/define_struct.html
@@ -3,7 +3,7 @@
BOOST_FUSION_DEFINE_STRUCT
-
+
@@ -27,7 +27,7 @@
BOOST_FUSION_DEFINE_STRUCT
@@ -37,7 +37,7 @@
Access Sequence.
BOOST_FUSION_DEFINE_STRUCT (
@@ -67,7 +67,7 @@
@@ -178,14 +178,14 @@
#include < boost / fusion / adapted / struct / define_struct . hpp >
#include < boost / fusion / include / define_struct . hpp >