Boost.RangeEx merged into Boost.Range

[SVN r60897]
This commit is contained in:
Neil Groves
2010-03-28 16:08:35 +00:00
parent 1461479a17
commit b0d1db7c2e
471 changed files with 48610 additions and 2065 deletions

View File

@ -0,0 +1,30 @@
[section:erase erase]
[heading Prototype]
``
template<
class Container,
class SinglePassRange
>
void erase(Container& target,
iterator_range<typename Container::iterator> to_erase);
``
[heading Description]
`erase` the iterator range `to_erase` from the container `target`.
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/erase.hpp`
[heading Requirements]
# `Container` supports erase of an iterator range.
[heading Complexity]
Linear. Proprotional to `distance(to_erase)`.
[endsect]

View File

@ -0,0 +1,68 @@
[section:for_each for_each]
[heading Prototype]
``
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryFunction
>
BinaryFunction for_each(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
BinaryFunction fn);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryFunction
>
BinaryFunction for_each(const SinglePassRange1& rng1,
SinglePassRange2& rng2,
BinaryFunction fn);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryFunction
>
BinaryFunction for_each(SinglePassRange1& rng1,
const SinglePassRange2& rng2,
BinaryFunction fn);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryFunction
>
BinaryFunction for_each(SinglePassRange1& rng1,
SinglePassRange2& rng2,
BinaryFunction fn);
``
[heading Description]
`for_each` traverses forward through `rng1` and `rng2` simultaneously.
For each iteration, the element `x` is used from `rng1` and the corresponding
element `y` is used from `rng2` to invoke `fn(x,y)`.
Iteration is stopped upon reaching the end of the shorter of `rng1`, or `rng2`.
It is safe to call this function with unequal length ranges.
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/for_each.hpp`
[heading Requirements]
# `SinglePassRange1` is a model of the __single_pass_range__ Concept.
# `SinglePassRange2` is a model of the __single_pass_range__ Concept.
# `BinaryFunction` is a model of the `BinaryFunctionConcept`.
# `SinglePassRange1`'s value type is convertible to `BinaryFunction`'s first argument type.
# `SinglepassRange2`'s value type is convertible to `BinaryFunction`'s second argument type.
[heading Complexity]
Linear. Exactly `min(distance(rng1), distance(rng2))` applications of `BinaryFunction`.
[endsect]

View File

@ -0,0 +1,33 @@
[section:insert insert]
[heading Prototype]
``
template<
class Container,
class SinglePassRange
>
void insert(Container& target,
typename Container::iterator before,
const SinglePassRange& from);
``
[heading Description]
`insert` all of the elements in the range `from` before the `before` iterator into `target`.
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/insert.hpp`
[heading Requirements]
# `SinglePassRange` is a model of the __single_pass_range__ Concept.
# `Container` supports insert at a specified position.
# `SinglePassRange`'s value type is convertible to `Container`'s value type.
[heading Complexity]
Linear. `distance(from)` assignments are performed.
[endsect]

View File

@ -0,0 +1,34 @@
[section:overwrite overwrite]
[heading Prototype]
``
template<
class SinglePassRange1,
class SinglePassRange2
>
void overwrite(const SinglePassRange1& from,
SinglePassRange2& to);
``
[heading Description]
`overwrite` assigns the values from the range `from` into the range `to`.
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/overwrite.hpp`
[heading Requirements]
# `SinglePassRange1` is a model of the __single_pass_range__ Concept.
# `SinglePassRange2` is a model of the __single_pass_range__ Concept.
# `SinglePassRange2` is mutable.
# `distance(SinglePassRange1) <= distance(SinglePassRange2)`
# `SinglePassRange1`'s value type is convertible to `SinglePassRange2`'s value type.
[heading Complexity]
Linear. `distance(rng1)` assignments are performed.
[endsect]

View File

@ -0,0 +1,32 @@
[section:push_back push_back]
[heading Prototype]
``
template<
class Container,
class SinglePassRange
>
void push_back(Container& target,
const SinglePassRange& from);
``
[heading Description]
`push_back` all of the elements in the range `from` to the back of the container `target`.
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/push_back.hpp`
[heading Requirements]
# `SinglePassRange` is a model of the __single_pass_range__ Concept.
# `Container` supports insert at `end()`.
# `SinglePassRange`'s value type is convertible to `Container`'s value type.
[heading Complexity]
Linear. `distance(from)` assignments are performed.
[endsect]

View File

@ -0,0 +1,32 @@
[section:push_front push_front]
[heading Prototype]
``
template<
class Container,
class SinglePassRange
>
void push_front(Container& target,
const SinglePassRange& from);
``
[heading Description]
`push_front` all of the elements in the range `from` to the front of the container `target`.
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/push_front.hpp`
[heading Requirements]
# `SinglePassRange` is a model of the __single_pass_range__ Concept.
# `Container` supports insert at `begin()`.
# `SinglePassRange`'s value type is convertible to `Container`'s value type.
[heading Complexity]
Linear. `distance(from)` assignments are performed.
[endsect]

View File

@ -0,0 +1,31 @@
[section:remove_erase remove_erase]
[heading Prototype]
``
template<
class Container,
class T
>
void remove_erase(Container& target,
const T& val);
``
[heading Description]
`remove_erase` actually eliminates the elements equal to `val` from the container. This
is in contrast to the `remove` algorithm which merely rearranges elements.
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/erase.hpp`
[heading Requirements]
# `Container` supports erase of an iterator range.
[heading Complexity]
Linear. Proportional to `distance(target)`s.
[endsect]

View File

@ -0,0 +1,32 @@
[section:remove_erase_if remove_erase_if]
[heading Prototype]
``
template<
class Container,
class Pred
>
void remove_erase(Container& target,
Pred pred);
``
[heading Description]
`remove_erase_if` removes the elements `x` that satisfy `pred(x)` from the container.
This is in contrast to the `erase` algorithm which merely rearranges elements.
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/erase.hpp`
[heading Requirements]
# `Container` supports erase of an iterator range.
# `Pred` is a model of the `Predicate` Concept.
[heading Complexity]
Linear. Proportional to `distance(target)`s.
[endsect]