Boost.Range updated the return types of various algorithms to improve consistency. This is to address a specific request made during the formal review of Boost.RangeEx.

[SVN r61211]
This commit is contained in:
Neil Groves
2010-04-11 22:05:02 +00:00
parent cab01e8ba3
commit 350a1f8bfc
108 changed files with 937 additions and 605 deletions

View File

@ -4,10 +4,7 @@
``
template<class ForwardRange, class Value>
void fill( ForwardRange& rng, const Value& val );
template<class ForwardRange, class Value>
void fill( const ForwardRange& rng, const Value& val );
ForwardRange& fill( ForwardRange& rng, const Value& val );
``
[heading Description]

View File

@ -0,0 +1,31 @@
[section:fill_n Range Algorithm - fill_n]
[heading Prototype]
``
template<class ForwardRange, class Size, class Value>
ForwardRange& fill( ForwardRange& rng, Size n, const Value& val );
``
[heading Description]
`fill_n` assigns the value `val` to `n` elements in the range `rng` begining with `boost::begin(rng)`.
[heading Definition]
Defined in the header file `boost/range/algorithm/fill_n.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is a model of the `AssignableConcept`.
* `Value` is convertible to `ForwardRange`'s value type.
[heading Complexity]
Linear. Exactly `n` assignments are performed.
[endsect]

View File

@ -4,16 +4,16 @@
``
template<class RandomAccessRange>
void make_heap(RandomAccessRange& rng);
RandomAccessRange& make_heap(RandomAccessRange& rng);
template<class RandomAccessRange>
void make_heap(const RandomAccessRange& rng);
const RandomAccessRange& make_heap(const RandomAccessRange& rng);
template<class RandomAccessRange, class Compare>
void make_heap(RandomAccessRange& rng, Compare pred);
RandomAccessRange& make_heap(RandomAccessRange& rng, Compare pred);
template<class RandomAccessRange, class Compare>
void make_heap(const RandomAccessRange& rng, Compare pred);
const RandomAccessRange& make_heap(const RandomAccessRange& rng, Compare pred);
``
[heading Description]
@ -21,7 +21,7 @@ void make_heap(const RandomAccessRange& rng, Compare pred);
`make_heap` turns `rng` into a heap.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/heap_algorithm.hpp`

View File

@ -4,16 +4,16 @@
``
template<class BidirectionalRange>
void next_permutation(BidirectionalRange& rng);
bool next_permutation(BidirectionalRange& rng);
template<class BidirectionalRange>
void next_permutation(const BidirectionalRange& rng);
bool next_permutation(const BidirectionalRange& rng);
template<class BidirectionalRange, class Compare>
void next_permutation(BidirectionalRange& rng, Compare pred);
bool next_permutation(BidirectionalRange& rng, Compare pred);
template<class BidirectionalRange, class Compare>
void next_permutation(const BidirectionalRange& rng, Compare pred);
bool next_permutation(const BidirectionalRange& rng, Compare pred);
``
[heading Description]
@ -21,7 +21,7 @@ void next_permutation(const BidirectionalRange& rng, Compare pred);
`next_permutation` transforms the range of elements `rng` into the lexicographically next greater permutation of the elements if such a permutation exists. If one does not exist then the range is transformed into the lexicographically smallest permutation and `false` is returned. `true` is returned when the next greater permutation is successfully generated.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/permutation.hpp`

View File

@ -4,22 +4,26 @@
``
template<class RandomAccessRange>
void nth_element(RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type nth);
RandomAccessRange& nth_element(
RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type nth);
template<class RandomAccessRange>
void nth_element(const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type nth);
const RandomAccessRange& nth_element(
const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type nth);
template<class RandomAccessRange>
void nth_element(RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type nth,
BinaryPredicate sort_pred);
RandomAccessRange& nth_element(
RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type nth,
BinaryPredicate sort_pred);
template<class RandomAccessRange>
void nth_element(const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type nth,
BinaryPredicate sort_pred);
const RandomAccessRange& nth_element(
const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type nth,
BinaryPredicate sort_pred);
``
[heading Description]

View File

@ -4,22 +4,26 @@
``
template<class RandomAccessRange>
void partial_sort(RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type middle);
RandomAccessRange& partial_sort(
RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type middle);
template<class RandomAccessRange>
void partial_sort(const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type middle);
const RandomAccessRange& partial_sort(
const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type middle);
template<class RandomAccessRange>
void partial_sort(RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type middle,
BinaryPredicate sort_pred);
RandomAccessRange& partial_sort(
RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type middle,
BinaryPredicate sort_pred);
template<class RandomAccessRange>
void partial_sort(const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type middle,
BinaryPredicate sort_pred);
const RandomAccessRange& partial_sort(
const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type middle,
BinaryPredicate sort_pred);
``
[heading Description]

View File

@ -4,16 +4,16 @@
``
template<class RandomAccessRange>
void pop_heap(RandomAccessRange& rng);
RandomAccessRange& pop_heap(RandomAccessRange& rng);
template<class RandomAccessRange>
void pop_heap(const RandomAccessRange& rng);
const RandomAccessRange& pop_heap(const RandomAccessRange& rng);
template<class RandomAccessRange, class Compare>
void pop_heap(RandomAccessRange& rng, Compare pred);
RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare pred);
template<class RandomAccessRange, class Compare>
void pop_heap(const RandomAccessRange& rng, Compare pred);
const RandomAccessRange& pop_heap(const RandomAccessRange& rng, Compare pred);
``
[heading Description]
@ -21,7 +21,7 @@ void pop_heap(const RandomAccessRange& rng, Compare pred);
`pop_heap` removes the largest element from the heap. It is assumed that `begin(rng), prior(end(rng))` is already a heap and that the element to be added is `*prior(end(rng))`.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/heap_algorithm.hpp`

View File

@ -4,16 +4,16 @@
``
template<class BidirectionalRange>
void prev_permutation(BidirectionalRange& rng);
bool prev_permutation(BidirectionalRange& rng);
template<class BidirectionalRange>
void prev_permutation(const BidirectionalRange& rng);
bool prev_permutation(const BidirectionalRange& rng);
template<class BidirectionalRange, class Compare>
void prev_permutation(BidirectionalRange& rng, Compare pred);
bool prev_permutation(BidirectionalRange& rng, Compare pred);
template<class BidirectionalRange, class Compare>
void prev_permutation(const BidirectionalRange& rng, Compare pred);
bool prev_permutation(const BidirectionalRange& rng, Compare pred);
``
[heading Description]
@ -21,7 +21,7 @@ void prev_permutation(const BidirectionalRange& rng, Compare pred);
`prev_permutation` transforms the range of elements `rng` into the lexicographically next smaller permutation of the elements if such a permutation exists. If one does not exist then the range is transformed into the lexicographically largest permutation and `false` is returned. `true` is returned when the next smaller permutation is successfully generated.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/permutation.hpp`

View File

@ -4,16 +4,16 @@
``
template<class RandomAccessRange>
void push_heap(RandomAccessRange& rng);
RandomAccessRange& push_heap(RandomAccessRange& rng);
template<class RandomAccessRange>
void push_heap(const RandomAccessRange& rng);
const RandomAccessRange& push_heap(const RandomAccessRange& rng);
template<class RandomAccessRange, class Compare>
void push_heap(RandomAccessRange& rng, Compare pred);
RandomAccessRange& push_heap(RandomAccessRange& rng, Compare pred);
template<class RandomAccessRange, class Compare>
void push_heap(const RandomAccessRange& rng, Compare pred);
const RandomAccessRange& push_heap(const RandomAccessRange& rng, Compare pred);
``
[heading Description]
@ -21,7 +21,7 @@ void push_heap(const RandomAccessRange& rng, Compare pred);
`push_heap` adds an element to a heap. It is assumed that `begin(rng)`, `prior(end(rng))` is already a heap and that the element to be added is `*prior(end(rng))`.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/heap_algorithm.hpp`

View File

@ -4,16 +4,16 @@
``
template<class RandomAccessRange>
void sort_heap(RandomAccessRange& rng);
RandomAccessRange& sort_heap(RandomAccessRange& rng);
template<class RandomAccessRange>
void sort_heap(const RandomAccessRange& rng);
const RandomAccessRange& sort_heap(const RandomAccessRange& rng);
template<class RandomAccessRange, class Compare>
void sort_heap(RandomAccessRange& rng, Compare pred);
RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare pred);
template<class RandomAccessRange, class Compare>
void sort_heap(const RandomAccessRange& rng, Compare pred);
const RandomAccessRange& sort_heap(const RandomAccessRange& rng, Compare pred);
``
[heading Description]
@ -21,7 +21,7 @@ void sort_heap(const RandomAccessRange& rng, Compare pred);
`sort_heap` turns a heap into a sorted range.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/heap_algorithm.hpp`