Initial commit

This commit is contained in:
2017-09-26 08:50:02 +02:00
commit 2efae33516
20126 changed files with 3599830 additions and 0 deletions
@@ -0,0 +1,37 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:copy_n copy_n]
[heading Prototype]
``
template<class SinglePassRange, class Size, class OutputIterator>
OutputIterator copy_n(const SinglePassRange& rng, Size n, OutputIterator out);
``
[heading Description]
`copy_n` is provided to completely replicate the standard algorithm header,
it is preferable to use Range Adaptors and the extension functions to achieve
the same result with greater safety.
`copy_n` copies elements from `[boost::begin(rng), boost::begin(rng) + n)` to the range `[out, out + n)`
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/copy_n.hpp`
[heading Requirements]
# `SinglePassRange` is a model of the __single_pass_range__ Concept.
# `Size` is a model of the `Integer` Concept.
# `OutputIterator` is a model of the `OutputIteratorConcept`.
[heading Complexity]
Linear. Exactly `n` elements are copied.
[endsect]
@@ -0,0 +1,37 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:erase erase]
[heading Prototype]
``
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`
[heading Requirements]
# `Container` supports erase of an iterator range.
[heading Complexity]
Linear. Proprotional to `distance(to_erase)`.
[endsect]
@@ -0,0 +1,73 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[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]
@@ -0,0 +1,46 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:insert insert]
[heading Prototype]
``
template<
class Container,
class SinglePassRange
>
Container& insert(Container& target,
typename Container::iterator before,
const SinglePassRange& from);
// This overload is for target containers that do not require an insertion
// position e.g. set/map
template<
class Container,
class SinglePassRange
>
Container& insert(Container& target, 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]
@@ -0,0 +1,33 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:iota iota]
[heading Prototype]
``
template<class ForwardRange, class Value>
ForwardRange& iota(ForwardRange& rng, Value x);
``
[heading Description]
`iota` traverses forward through `rng`, each element `y` in `rng` is assigned a value equivalent
to `x + boost::distance(boost::begin(rng), it)`
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/iota.hpp`
[heading Requirements]
# `ForwardRange` is a model of the __forward_range__ Concept.
# `Value` is a model of the `Incrementable` Concept.
[heading Complexity]
Linear. Exactly `distance(rng)` assignments into `rng`.
[endsect]
@@ -0,0 +1,40 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:is_sorted is_sorted]
[heading Prototype]
``
template<class SinglePassRange>
bool is_sorted(const SinglePassRange& rng);
template<class SinglePassRange, class BinaryPredicate>
bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred);
``
[heading Description]
`is_sorted` determines if a range is sorted.
For the non-predicate version the return value is `true` if and only if for
each adjacent elements `[x,y]` the expression `x < y` is `true`.
For the predicate version the return value is `true` is and only if for each
adjacent elements `[x,y]` the expression `pred(x,y)` is `true`.
[heading Definition]
Defined in the header file `boost/range/algorithm_ext/is_sorted.hpp`
[heading Requirements]
# `SinglePassRange` is a model of the __single_pass_range__ Concept.
# `BinaryPredicate` is a model of the `BinaryPredicate` Concept.
# The value type of `SinglePassRange` is convertible to both argument types of `BinaryPredicate`.
[heading Complexity]
Linear. A maximum of `distance(rng)` comparisons are performed.
[endsect]
@@ -0,0 +1,39 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[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]
@@ -0,0 +1,37 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:push_back push_back]
[heading Prototype]
``
template<
class Container,
class SinglePassRange
>
Container& 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]
@@ -0,0 +1,37 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:push_front push_front]
[heading Prototype]
``
template<
class Container,
class SinglePassRange
>
Container& 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]
@@ -0,0 +1,33 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:remove_erase remove_erase]
[heading Prototype]
``
template<class Container, class Value>
Container& remove_erase(Container& target,
const Value& value);
``
[heading Description]
`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]
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]
@@ -0,0 +1,34 @@
[/
Copyright 2010 Neil Groves
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section:remove_erase_if remove_erase_if]
[heading Prototype]
``
template<class Container, class Pred>
Container& remove_erase_if(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]