mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-08-14 15:33:36 -04:00
Squashed 'boost/' content from commit b4feb19f2
git-subtree-dir: boost git-subtree-split: b4feb19f287ee92d87a9624b5d36b7cf46aeadeb
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
[/
|
||||
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:any_range any_range]
|
||||
|
||||
[heading Description]
|
||||
|
||||
`any_range` is a range that has the type information erased hence a `any_range<int, boost::forward_traversal_tag, int, std::ptrdiff_t>`
|
||||
can be used to represent a `std::vector<int>`, a `std::list<int>` or many other types.
|
||||
|
||||
The __type_erasure_article__ covers the motivation and goals of type erasure in this context. Clearly
|
||||
my implementation is building upon a lot of prior art created by others. Thomas Becker's `any_iterator` was a strong
|
||||
influence. Adobe also have an `any_iterator` implementation, but this has very tight coupling to other parts of the
|
||||
library that precluded it from use in Boost.Range.
|
||||
Early development versions of this Range Adaptor directly used Thomas Becker's any_iterator implementation.
|
||||
Subsequently I discovered that the heap allocations of this and many other implementations cause poor
|
||||
speed performance particularly at the tails of the distribution. To solve this required a new design that
|
||||
incorporated the embedded buffer optimization.
|
||||
|
||||
Despite the underlying `any_iterator` being the fastest available implementation, the performance overhead of `any_range` is still appreciable due to the cost of virtual function calls required to implement `increment`, `decrement`, `advance`, `equal` etc. Frequently a better design choice is to convert to a canonical form.
|
||||
|
||||
Please see the __range_adaptors_type_erased__ for a Range Adaptor that returns `any_range` instances.
|
||||
|
||||
[heading Synopsis]
|
||||
|
||||
``
|
||||
template<
|
||||
class Value
|
||||
, class Traversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer = any_iterator_default_buffer
|
||||
>
|
||||
class any_range
|
||||
: public iterator_range<
|
||||
range_detail::any_iterator<
|
||||
Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>
|
||||
>
|
||||
{
|
||||
typedef range_detail::any_iterator<
|
||||
Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
> any_iterator_type;
|
||||
|
||||
typedef iterator_range<any_iterator_type> base_type;
|
||||
|
||||
struct enabler {};
|
||||
struct disabler {};
|
||||
public:
|
||||
typedef any_iterator_type iterator;
|
||||
typedef any_iterator_type const_iterator;
|
||||
|
||||
any_range()
|
||||
{
|
||||
}
|
||||
|
||||
any_range(const any_range& other)
|
||||
: base_type(other)
|
||||
{
|
||||
}
|
||||
|
||||
template<class WrappedRange>
|
||||
any_range(WrappedRange& wrapped_range)
|
||||
: base_type(boost::begin(wrapped_range),
|
||||
boost::end(wrapped_range))
|
||||
{
|
||||
}
|
||||
|
||||
template<class WrappedRange>
|
||||
any_range(const WrappedRange& wrapped_range)
|
||||
: base_type(boost::begin(wrapped_range),
|
||||
boost::end(wrapped_range))
|
||||
{
|
||||
}
|
||||
|
||||
template<
|
||||
class OtherValue
|
||||
, class OtherTraversal
|
||||
, class OtherReference
|
||||
, class OtherDifference
|
||||
>
|
||||
any_range(const any_range<
|
||||
OtherValue
|
||||
, OtherTraversal
|
||||
, OtherReference
|
||||
, OtherDifference
|
||||
, Buffer
|
||||
>& other)
|
||||
: base_type(boost::begin(other), boost::end(other))
|
||||
{
|
||||
}
|
||||
|
||||
template<class Iterator>
|
||||
any_range(Iterator first, Iterator last)
|
||||
: base_type(first, last)
|
||||
{
|
||||
}
|
||||
};
|
||||
``
|
||||
|
||||
[heading Definition]
|
||||
|
||||
Defined in header file `boost/range/any_range.hpp`
|
||||
|
||||
[endsect]
|
||||
@@ -0,0 +1,36 @@
|
||||
[/
|
||||
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:counting_range counting_range]
|
||||
|
||||
[heading Prototype]
|
||||
|
||||
``
|
||||
template< class Incrementable > inline
|
||||
iterator_range< counting_iterator<Incrementable> >
|
||||
counting_range(Incrementable first, Incrementable last);
|
||||
|
||||
template< class SinglePassRange > inline
|
||||
iterator_range< counting_iterator<typename range_iterator<SinglePassRange>::type >
|
||||
counting_range(const SinglePassRange& rng);
|
||||
|
||||
template< class SinglePassRange > inline
|
||||
iterator_range< counting_iterator<typename range_iterator<SinglePassRange>::type >
|
||||
counting_range(SinglePassRange& rng);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
||||
`counting_range` is a function to generator that generates an `iterator_range` wrapping a `counting_iterator` (from Boost.Iterator).
|
||||
|
||||
[heading Definition]
|
||||
|
||||
Defined in header file `boost/range/counting_range.hpp`
|
||||
|
||||
[heading Requirements]
|
||||
|
||||
# `Incrementable` is a model of the `Incrementable` Concept.
|
||||
|
||||
[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:irange irange]
|
||||
|
||||
[heading Prototype]
|
||||
|
||||
``
|
||||
template<class Integer>
|
||||
iterator_range< range_detail::integer_iterator<Integer> >
|
||||
irange(Integer first, Integer last);
|
||||
|
||||
template<class Integer, class StepSize>
|
||||
iterator_range< range_detail::integer_iterator_with_step<Integer, StepSize> >
|
||||
irange(Integer first, Integer last, StepSize step_size);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
||||
`irange` is a function to generate an Integer Range.
|
||||
|
||||
`irange` allows treating integers as a model of the __random_access_range__ Concept. It should be noted that the `first` and `last` parameters denoted a half-open range.
|
||||
|
||||
[heading Definition]
|
||||
|
||||
Defined in the header file `boost/range/irange.hpp`
|
||||
|
||||
[heading Requirements]
|
||||
|
||||
# `Integer` is a model of the `Integer` Concept.
|
||||
# `StepSize` is a model of the `SignedInteger` Concept.
|
||||
|
||||
[heading Complexity]
|
||||
|
||||
Constant. Since this function generates a new range the most significant performance cost is incurred through the iteration of the generated range.
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
[/
|
||||
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:istream_range istream_range]
|
||||
|
||||
[heading Prototype]
|
||||
|
||||
``
|
||||
template< class Type, class Elem, class Traits > inline
|
||||
iterator_range< std::istream_iterator<Type, Elem, Traits> >
|
||||
istream_range(std::basic_istream<Elem, Traits>& in);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
||||
`istream_range` is a function to generator that generates an `iterator_range` wrapping a `std::istream_iterator`.
|
||||
|
||||
[heading Definition]
|
||||
|
||||
Defined in header file `boost/range/istream_range.hpp`
|
||||
|
||||
[endsect]
|
||||
Reference in New Issue
Block a user