forked from boostorg/range
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:
@ -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]
|
||||
|
31
doc/reference/algorithm/fill_n.qbk
Normal file
31
doc/reference/algorithm/fill_n.qbk
Normal 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]
|
||||
|
||||
|
@ -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`
|
||||
|
@ -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`
|
||||
|
@ -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]
|
||||
|
@ -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]
|
||||
|
@ -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`
|
||||
|
@ -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`
|
||||
|
@ -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`
|
||||
|
@ -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`
|
||||
|
@ -3,18 +3,20 @@
|
||||
[heading Prototype]
|
||||
|
||||
``
|
||||
template<
|
||||
class Container,
|
||||
class SinglePassRange
|
||||
>
|
||||
void erase(Container& target,
|
||||
iterator_range<typename Container::iterator> to_erase);
|
||||
template<class Container>
|
||||
Container& erase(
|
||||
Container& target,
|
||||
iterator_range<typename Container::iterator> to_erase);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
||||
`erase` the iterator range `to_erase` from the container `target`.
|
||||
|
||||
`remove_erase` performs the frequently used combination equivalent to `target.erase(std::remove(target.begin(), target.end(), value), target.end());`
|
||||
|
||||
`remove_erase_if` performs the frequently used combination equivalent to `target.erase(std::remove_if(target.begin(), target.end(), pred), target.end());`
|
||||
|
||||
[heading Definition]
|
||||
|
||||
Defined in the header file `boost/range/algorithm_ext/erase.hpp`
|
||||
|
@ -7,9 +7,9 @@ template<
|
||||
class Container,
|
||||
class SinglePassRange
|
||||
>
|
||||
void insert(Container& target,
|
||||
typename Container::iterator before,
|
||||
const SinglePassRange& from);
|
||||
Container& insert(Container& target,
|
||||
typename Container::iterator before,
|
||||
const SinglePassRange& from);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
@ -3,8 +3,8 @@
|
||||
[heading Prototype]
|
||||
|
||||
``
|
||||
template<class SinglePassRange, class Value>
|
||||
iota(SinglePassRange& rng, Value x);
|
||||
template<class ForwardRange, class Value>
|
||||
ForwardRange& iota(ForwardRange& rng, Value x);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
@ -18,7 +18,7 @@ Defined in the header file `boost/range/algorithm_ext/iota.hpp`
|
||||
|
||||
[heading Requirements]
|
||||
|
||||
# `SinglePassRange` is a model of the __single_pass_range__ Concept.
|
||||
# `ForwardRange` is a model of the __forward_range__ Concept.
|
||||
# `Value` is a model of the `Incrementable` Concept.
|
||||
|
||||
[heading Complexity]
|
||||
|
@ -7,8 +7,8 @@ template<
|
||||
class Container,
|
||||
class SinglePassRange
|
||||
>
|
||||
void push_back(Container& target,
|
||||
const SinglePassRange& from);
|
||||
Container& push_back(Container& target,
|
||||
const SinglePassRange& from);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
@ -7,8 +7,8 @@ template<
|
||||
class Container,
|
||||
class SinglePassRange
|
||||
>
|
||||
void push_front(Container& target,
|
||||
const SinglePassRange& from);
|
||||
Container& push_front(Container& target,
|
||||
const SinglePassRange& from);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
@ -3,17 +3,14 @@
|
||||
[heading Prototype]
|
||||
|
||||
``
|
||||
template<
|
||||
class Container,
|
||||
class T
|
||||
>
|
||||
void remove_erase(Container& target,
|
||||
const T& val);
|
||||
template<class Container, class Value>
|
||||
Container& remove_erase(Container& target,
|
||||
const Value& value);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
||||
`remove_erase` actually eliminates the elements equal to `val` from the container. This
|
||||
`remove_erase` actually eliminates the elements equal to `value` from the container. This
|
||||
is in contrast to the `remove` algorithm which merely rearranges elements.
|
||||
|
||||
[heading Definition]
|
||||
|
@ -3,12 +3,9 @@
|
||||
[heading Prototype]
|
||||
|
||||
``
|
||||
template<
|
||||
class Container,
|
||||
class Pred
|
||||
>
|
||||
void remove_erase(Container& target,
|
||||
Pred pred);
|
||||
template<class Container, class Pred>
|
||||
Container& remove_erase_if(Container& target,
|
||||
Pred pred);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
@ -82,6 +82,7 @@ and there is no need to worry about generating an invalid range. Furthermore, if
|
||||
[include algorithm/copy.qbk]
|
||||
[include algorithm/copy_backward.qbk]
|
||||
[include algorithm/fill.qbk]
|
||||
[include algorithm/fill_n.qbk]
|
||||
[include algorithm/generate.qbk]
|
||||
[include algorithm/inplace_merge.qbk]
|
||||
[include algorithm/merge.qbk]
|
||||
@ -133,6 +134,7 @@ and there is no need to worry about generating an invalid range. Furthermore, if
|
||||
[include algorithm/push_heap.qbk]
|
||||
[include algorithm/pop_heap.qbk]
|
||||
[include algorithm/make_heap.qbk]
|
||||
[include algorithm/sort_heap.qbk]
|
||||
[endsect]
|
||||
|
||||
[section:permutation_algorithms Permutation algorithms]
|
||||
|
Reference in New Issue
Block a user