Boost.Range documentation update iteration.

[SVN r61647]
This commit is contained in:
Neil Groves
2010-04-28 16:09:03 +00:00
parent adc4b5db3b
commit abc18532e4
169 changed files with 5356 additions and 2838 deletions

View File

@ -1,4 +1,4 @@
[section:adjacent_find Range Algorithm - adjacent_find]
[section:adjacent_find adjacent_find]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:copy Range Algorithm - copy]
[section:copy copy]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:copy_backward Range Algorithm - copy_backward]
[section:copy_backward copy_backward]
[heading Prototype]

View File

@ -0,0 +1,32 @@
[section:count_if count_if]
[heading Prototype]
``
template<class SinglePassRange, class UnaryPredicate>
typename range_difference<const SinglePassRange>::type
count_if(const SinglePassRange& rng, UnaryPredicate pred);
``
[heading Description]
`count_if` returns the number of elements `x` in `rng` where `pred(x)` is `true`.
[heading Definition]
Defined in the header file `boost/range/algorithm/count_if.hpp`
[heading Requirements]
* `SinglePassRange` is a model of the __single_pass_range__ Concept.
* `UnaryPredicate` is a model of the `UnaryPredicateConcept`.
* `SinglePassRange`'s value type is a model of the `EqualityComparableConcept`.
* The value type of `SinglePassRange` is convertible to the argument type of `UnaryPredicate`.
[heading Complexity]
Linear. Exactly `distance(rng)` invocations of `pred`.
[endsect]

View File

@ -1,4 +1,4 @@
[section:fill Range Algorithm - fill]
[section:fill fill]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:fill_n Range Algorithm - fill_n]
[section:fill_n fill_n]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:generate Range Algorithm - generate]
[section:generate generate]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:inplace_merge Range Algorithm - inplace_merge]
[section:inplace_merge inplace_merge]
[heading Prototype]
@ -7,18 +7,18 @@ template<class BidirectionalRange>
BidirectionalRange&
inplace_merge( BidirectionalRange& rng,
typename range_iterator<BidirectionalRange>::type middle );
template<class BidirectionalRange>
const BidirectionalRange&
inplace_merge( const BidirectionalRange& rng,
typename range_iterator<const BidirectionalRange>::type middle );
template<class BidirectionalRange, class BinaryPredicate>
BidirectionalRange&
inplace_merge( BidirectionalRange& rng,
typename range_iterator<BidirectionalRange>::type middle,
BinaryPredicate pred );
template<class BidirectionalRange, class BinaryPredicate>
const BidirectionalRange&
inplace_merge( const BidirectionalRange& rng,

View File

@ -1,4 +1,4 @@
[section:merge Range Algorithm - merge]
[section:merge merge]
[heading Prototype]

View File

@ -75,7 +75,7 @@ mismatch(const SinglePassRange1& rng1, SinglePassRange2& rng2,
[heading Description]
The versions of `mismatch` that return an iterator, return an iterator to the first position where `rng1` and `rng2` differ.
`mismatch` finds the first position where the two ranges `rng1` and `rng2` differ.
Equality is determined by `operator==` for non-predicate versions of `mismatch`, and by satisfying `pred` in the predicate versions.

View File

@ -1,4 +1,4 @@
[section:nth_element Range Algorithm - nth_element]
[section:nth_element nth_element]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:partial_sort Range Algorithm - partial_sort]
[section:partial_sort partial_sort]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:partition Range Algorithm - partition]
[section:partition partition]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:random_shuffle Range Algorithm - random_shuffle]
[section:random_shuffle random_shuffle]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:remove Range Algorithm - remove]
[section:remove remove]
[heading Prototype]

View File

@ -0,0 +1,34 @@
[section:remove_copy remove_copy]
[heading Prototype]
``
template<class ForwardRange, class Outputiterator, class Value>
OutputIterator
remove_copy(ForwardRange& rng, OutputIterator out, const Value& val);
template<class ForwardRange, class OutputIterator, class Value>
OutputIterator
remove_copy(const ForwardRange& rng, OutputIterator out, const Value& val);
``
[heading Description]
`remove_copy` copied all of the elements `x` from `rng` for which `x == val` is `false`.
[heading Definition]
Defined in the header file `boost/range/algorithm/remove_copy.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is a model of the `EqualityComparableConcept`.
* Objects of type `Value` can be compared for equality with objects of `ForwardRange`'s value type.
[heading Complexity]
Linear. `remove_copy` performs exactly `distance(rng)` comparisons for equality.
[endsect]

View File

@ -0,0 +1,33 @@
[section:remove_copy_if remove_copy_if]
[heading Prototype]
``
template<class ForwardRange, class Outputiterator, class UnaryPred>
OutputIterator
remove_copy_if(ForwardRange& rng, OutputIterator out, UnaryPred pred);
template<class ForwardRange, class OutputIterator, class UnaryPred>
OutputIterator
remove_copy_if(const ForwardRange& rng, OutputIterator out, UnaryPred pred);
``
[heading Description]
`remove_copy_if` copied all of the elements `x` from `rng` for which `pred(x)` is `false`.
[heading Definition]
Defined in the header file `boost/range/algorithm/remove_copy_if.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `UnaryPred` is a model of the `UnaryPredicateConcept`.
[heading Complexity]
Linear. `remove_copy_if` performs exactly `distance(rng)` comparisons with UnaryPred.
[endsect]

View File

@ -1,4 +1,4 @@
[section:remove_if Range Algorithm - remove_if]
[section:remove_if remove_if]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:replace Range Algorithm - replace]
[section:replace replace]
[heading Prototype]

View File

@ -0,0 +1,33 @@
[section:replace_copy replace_copy]
[heading Prototype]
``
template<class ForwardRange, class OutputIterator, class Value>
OutputIterator replace_copy(const ForwardRange& rng, OutputIterator out,
const Value& what, const Value& with_what);
``
[heading Description]
`replace_copy` copy every element `x` in `rng` such that the corresponding element in the output range `y` is `x == what ? with_what : x`.
[heading Definition]
Defined in the header file `boost/range/algorithm/replace_copy.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is convertible to `ForwardRange`'s value type.
* `Value` is a model of the `AssignableConcept`.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
[heading Complexity]
Linear. `replace_copy` performs exactly `distance(rng)`.
[endsect]

View File

@ -0,0 +1,34 @@
[section:replace_copy_if replace_copy_if]
[heading Prototype]
``
template<class ForwardRange, class OutputIterator, class UnaryPredicate, class Value>
OutputIterator replace_copy_if(const ForwardRange& rng, OutputIterator out,
UnaryPredicate pred, const Value& with_what);
``
[heading Description]
`replace_copy_if` copy every element `x` in `rng` such that the corresponding element in the output range `y` is `pred(x) ? with_what : x`.
[heading Definition]
Defined in the header file `boost/range/algorithm/replace_copy_if.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is convertible to `ForwardRange`'s value type.
* `Value` is a model of the `AssignableConcept`.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `UnaryPredicate` is a model of the `UnaryPredicateConcept`.
[heading Complexity]
Linear. `replace_copy_if` performs exactly `distance(rng)` evaluations of `pred`.
[endsect]

View File

@ -1,4 +1,4 @@
[section:replace_if Range Algorithm - replace_if]
[section:replace_if replace_if]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:reverse Range Algorithm - reverse]
[section:reverse reverse]
[heading Prototype]

View File

@ -0,0 +1,31 @@
[section:reverse_copy reverse_copy]
[heading Prototype]
``
template<class BidirectionalRange, class OutputIterator>
OutputIterator reverse_copy(const BidirectionalRange& rng, OutputIterator out);
``
[heading Description]
`reverse_copy` copies the elements from `rng` in reverse order to `out`.
Returns the output iterator one passed the last copied element.
[heading Definition]
Defined in the header file `boost/range/algorithm/reverse_copy.hpp`
[heading Requirements]
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
* `BidirectionalRange` is mutable.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
[heading Complexity]
Linear. `reverse_copy` makes `distance(rng)` copies.
[endsect]

View File

@ -1,4 +1,4 @@
[section:rotate Range Algorithm - rotate]
[section:rotate rotate]
[heading Prototype]
@ -6,7 +6,7 @@
template<class ForwardRange>
ForwardRange& rotate(ForwardRange& rng,
typename range_iterator<ForwardRange>::type middle);
template<class ForwardRange>
const ForwardRange& rotate(const ForwardRange& rng,
typename range_iterator<const ForwardRange>::type middle);

View File

@ -0,0 +1,38 @@
[section:rotate_copy rotate_copy]
[heading Prototype]
``
template<class ForwardRange, class OutputIterator>
OutputIterator rotate_copy(
const ForwardRange& rng,
typename range_iterator<ForwardRange>::type middle,
OutputIterator out);
``
[heading Description]
`rotate_copy` rotates the elements in a range. It copies the two ranges `[begin(rng), middle)` and `[middle, end(rng))` to `out`.
[heading Definition]
Defined in the header file `boost/range/algorithm/rotate_copy.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
[heading Precondition:]
* `[begin(rng), middle)` is a valid range.
* `[middle, end(rng))` is a valid range.
[heading Complexity]
Linear. Exactly `distance(rng)` elements are copied.
[endsect]

View File

@ -0,0 +1,58 @@
[section:search_n search_n]
[heading Prototype]
``
template<class ForwardRange, class Integer, class Value>
typename range_iterator<ForwardRange>::type
search_n(ForwardRange& rng, Integer n, const Value& value);
template<class ForwardRange, class Integer, class Value>
typename range_iterator<const ForwardRange>::type
search_n(const ForwardRange& rng, Integer n, const Value& value);
template<class ForwardRange, class Integer, class Value, class BinaryPredicate>
typename range_iterator<ForwardRange>::type
search_n(ForwardRange& rng, Integer n, const Value& value,
BinaryPredicate binary_pred);
template<class ForwardRange, class Integer, class Value, class BinaryPredicate>
typename range_iterator<const ForwardRange>::type
search_n(const ForwardRange& rng, Integer n, const Value& value,
BinaryPredicate binary_pred);
``
[heading Description]
`search_n` searches `rng` for a sequence of length `n` equal to `value` where
equality is determined by operator== in the non-predicate case, and by a
predicate when one is supplied.
[heading Definition]
Defined in the header file `boost/range/algorithm/search_n.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange`'s value type is a model of the `EqualityComparableConcept`.
* `ForwardRange`s value type can be compared for equality with `Value`.
* `Integer` is a model of the `IntegerConcept`.
[*For the predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `ForwardRange`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `Value` is convertible to `BinaryPredicate`'s second argument type.
* `Integer` is a model of the `IntegerConcept`.
[heading Complexity]
Average complexity is Linear. Worst-case complexity is quadratic.
[endsect]

View File

@ -1,4 +1,4 @@
[section:sort Range Algorithm - sort]
[section:sort sort]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:stable_partition Range Algorithm - stable_partition]
[section:stable_partition stable_partition]
[heading Prototype]

View File

@ -1,4 +1,4 @@
[section:stable_sort Range Algorithm - stable_sort]
[section:stable_sort stable_sort]
[heading Prototype]

View File

@ -0,0 +1,32 @@
[section:swap_ranges swap_ranges]
[heading Prototype]
``
template<class SinglePassRange1, class SinglePassRange2>
SinglePassRange2& swap_ranges(SinglePassRange1& rng1, SinglePassRange& rng2);
``
[heading Description]
`swap_ranges` swaps each element `x` in `rng1` with the corresponding element `y` in `rng2`.
Returns a reference to `rng2`.
[heading Definition]
Defined in the header file `boost/range/algorithm/swap_ranges.hpp`
[heading Requirements]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange1` is mutable.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is mutable.
[heading Complexity]
Linear. Exactly `distance(rng1)` elements are swapped.
[endsect]

View File

@ -1,4 +1,4 @@
[section:transform Range Algorithm - transform]
[section:transform transform]
[heading Prototype]
@ -11,7 +11,7 @@ template<
OutputIterator transform(const SinglePassRange1& rng,
OutputIterator out,
UnaryOperation fun);
template<
class SinglePassRange1,
class SinglePassRange2,

View File

@ -1,4 +1,4 @@
[section:unique Range Algorithm - unique]
[section:unique unique]
[heading Prototype]

View File

@ -0,0 +1,44 @@
[section:unique_copy unique_copy]
[heading Prototype]
``
template<class SinglePassRange, class OutputIterator>
OutputIterator unique_copy(const SinglePassRange& rng, OutputIterator out);
template<class SinglePassRange, class OutputIterator, class BinaryPredicate>
OutputIterator unique_copy(const SinglePassRange& rng, OutputIterator out, BinaryPredicate pred);
``
[heading Description]
`unique_copy` copies the first element of each sequence of duplicates encountered in `rng` to `out`.
Equality is determined by the predicate if one is supplied, or by `operator==()` for `SinglePassRange`'s value type.
[heading Definition]
Defined in the header file `boost/range/algorithm/unique_copy.hpp`
[heading Requirements]
[*For the non-predicate versions of unique:]
* `SinglePassRange` is a model of the __single_pass_range__ Concept.
* `SinglePassRange` is mutable.
* `SinglePassRange`'s value type is a model of the `EqualityComparableConcept`.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
[*For the predicate versions of unique:]
* `SinglePassRange` is a model of the __single_pass_range__ Concept.
* `SinglePassRange` is mutable.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `SinglePassRange`'s value type is convertible to `BinaryPredicate`'s first argument type and to `BinaryPredicate`'s second argument type.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
[heading Complexity]
Linear. `O(N)` where `N` is `distance(rng)`. Exactly `distance(rng)` comparisons are performed.
[endsect]