diff --git a/doc/sequences.qbk b/doc/sequences.qbk index 26270ee1..2c553f7c 100644 --- a/doc/sequences.qbk +++ b/doc/sequences.qbk @@ -1382,7 +1382,7 @@ __boost_variant_library__ [section Intrinsics] -Intrinsics form the essential interface of Fusion __sequence__s. __stl__ +Intrinsics form the essential interface of every Fusion __sequence__. __stl__ counterparts of these functions are usually implemented as member functions. Intrinsic functions, unlike __algorithms__, are not generic across the full __sequence__ repertoire. They need to be implemented for @@ -1851,6 +1851,44 @@ convertable to the element associated with Key. [endsect] +[section swap] + +[heading Description] + +Performs an element by element swap of the elements in 2 sequences. + +[heading Synopsis] + template + void swap(Seq1& seq1, Seq2& seq2); + +[heading Parameters] + +[table + [[Parameters] [Requirement] [Description]] + [[`seq1`, `seq2`] [Models of __forward_sequence__][The sequences whos elements we wish to swap.]] +] + +[heading Expression Semantics] + + swap(seq1, seq2); + +[*Return type]: `void` + +[*Precondition]: `__size__(seq1) == __size__(seq2)` + +[*Semantics]: Calls `swap(a1, b1)` for corresponding elements in `seq1` and `seq2`. + +[heading Header] + #include + +[heading Example] + __vector__ v1(1, "hello"), v2(2, "world"); + swap(v1, v2); + assert(v1 == __make_vector__(2, "world")); + assert(v2 == __make_vector__(1, "hello")); + +[endsect] + [endsect] [section Metafunctions] @@ -2327,6 +2365,35 @@ Returns the actual element type associated with a Key from the __sequence__. [endsect] +[section swap] + +[heading Description] +Returns the return type of swap. + +[heading Synopsis] + template + struct swap + { + typedef void type; + }; + +[table Parameters + [[Parameters] [Requirement] [Description]] + [[`Seq1`, `Seq2`][Models of __forward_sequence__][The sequences being swapped]] +] + +[heading Expression Semantics] + result_of::swap::type + +[*Return type]: `void`. + +[*Semantics]: Always returns `void`. + +[heading Header] + #include + +[endsect] + [endsect] [endsect]