diff --git a/doc/algorithm.qbk b/doc/algorithm.qbk index 9ad943ee..dcb911fd 100644 --- a/doc/algorithm.qbk +++ b/doc/algorithm.qbk @@ -69,7 +69,7 @@ It is also used to convert sequence into other. [heading Synopsis] template - void copy(Seq1 const& src, Seq2& dest); + typename __result_of_copy__::type copy(Seq1 const& src, Seq2& dest); [table Parameters [[Parameter][Requirement][Description]] @@ -100,6 +100,119 @@ Linear, exactly `__result_of_size__::value`. [endsect] +[section move] + +[heading Description] +move a sequence `src` to a sequence `dest`. +It is also used to convert sequence into other. + +[heading Synopsis] + template + typename __result_of_move__::type move(Seq1&& src, Seq2& dest); + +[table Parameters + [[Parameter][Requirement][Description]] + [[`src`][A model of __forward_sequence__, all elements contained in the `src` sequence should be convertible into the element contained in the `dest` sequence.][Operation's argument]] + [[`dest`][A model of __forward_sequence__, `e2 = std::move(e1)` is valid expression for each pair of elements `e1` of `src` and `e2` of `dest`.][Operation's argument]] +] + +[heading Expression Semantics] + __move__(src, dest); + +[*Return type]: `void` + +[*Semantics]: `e2 = std::move(e1)` for each element `e1` in `src` and `e2` in `dest`. + +[heading Complexity] +Linear, exactly `__result_of_size__::value`. + +[heading Header] + + #include + #include + +[heading Example] + __vector__ vec(1,2); + __list__ ls; + __move__(std::move(vec), ls); + assert(ls == __make_list__(1,2)); + +[endsect] + +[endsect] + +[section Metafunctions] + +[section copy] + +[heading Description] +A metafunction returning the result type of applying __copy__, which is always `void`. + +[heading Synopsis] + template + struct copy + { + typedef void type; + }; + +[table Parameters + [[Parameter] [Requirement] [Description]] + [[`Seq1`] [A model of __forward_sequence__] [Operation's argument]] + [[`Seq2`] [A model of __forward_sequence__] [Operation's argument]] +] + +[heading Expression Semantics] + result_of::copy::type + +[*Return type]: `void` + +[*Semantics]: Returns the return type of __copy__ for 2 sequences of types `Seq1` and `Seq2`. + +[heading Complexity] +Constant. + +[heading Header] + + #include + #include + +[endsect] + +[section move] + +[heading Description] +A metafunction returning the result type of applying __move__, which is always `void`. + +[heading Synopsis] + template + struct move + { + typedef void type; + }; + +[table Parameters + [[Parameter] [Requirement] [Description]] + [[`Seq1`] [A model of __forward_sequence__] [Operation's argument]] + [[`Seq2`] [A model of __forward_sequence__] [Operation's argument]] +] + +[heading Expression Semantics] + result_of::move::type + +[*Return type]: `void` + +[*Semantics]: Returns the return type of __move__ for 2 sequences of types `Seq1` and `Seq2`. + +[heading Complexity] +Constant. + +[heading Header] + + #include + #include + +[endsect] + [endsect] [endsect] diff --git a/doc/fusion.qbk b/doc/fusion.qbk index f5d921de..7a943c14 100644 --- a/doc/fusion.qbk +++ b/doc/fusion.qbk @@ -226,6 +226,9 @@ [def __algorithm__ [link fusion.algorithm Algorithm]] [def __algorithms__ [link fusion.algorithm Algorithms]] [def __copy__ [link fusion.algorithm.auxiliary.functions.copy `copy`]] +[def __result_of_copy__ [link fusion.algorithm.auxiliary.metafunctions.copy `result_of::copy`]] +[def __move__ [link fusion.algorithm.auxiliary.functions.move `move`]] +[def __result_of_move__ [link fusion.algorithm.auxiliary.metafunctions.move `result_of::move`]] [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`]] diff --git a/doc/html/index.html b/doc/html/index.html index 2279bd54..03b417ee 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -190,7 +190,10 @@
Algorithm
Auxiliary
-
Functions
+
+
Functions
+
Metafunctions
+
Iteration
Functions
diff --git a/include/boost/fusion/algorithm/auxiliary/copy.hpp b/include/boost/fusion/algorithm/auxiliary/copy.hpp index f8e16e92..dab1a410 100644 --- a/include/boost/fusion/algorithm/auxiliary/copy.hpp +++ b/include/boost/fusion/algorithm/auxiliary/copy.hpp @@ -60,6 +60,15 @@ namespace boost { namespace fusion }; } + namespace result_of + { + template + struct copy + { + typedef void type; + }; + } + template BOOST_FUSION_GPU_ENABLED inline typename enable_if + struct move + { + typedef void type; + }; + } + template BOOST_FUSION_GPU_ENABLED inline typename enable_if