...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
iterator_range
presents a
sub-range of its underlying sequence delimited by a pair of iterators.
#include <boost/fusion/view/iterator_range.hpp> #include <boost/fusion/include/iterator_range.hpp>
template <typename First, typename Last> struct iterator_range;
First
and Last
implement the
Associative
Iterator model.
Notation
IR
An iterator_range
type
f
An instance of First
l
An instance of Last
ir
, ir2
Instances of iterator_range
Semantics of an expression is defined only where it differs from, or is not defined in the implemented models.
Expression |
Semantics |
---|---|
|
Creates an |
|
Copy constructs an |
|
Assigns to a |
char const* s = "Ruby"; typedefvector
<int, char, double, char const*> vector_type; vector_type vec(1, 'x', 3.3, s); typedefresult_of::begin
<vector_type>::type A; typedefresult_of::end
<vector_type>::type B; typedefresult_of::next
<A>::type C; typedefresult_of::prior
<B>::type D; C c(vec); D d(vec); iterator_range<C, D> range(c, d); std::cout << range << std::endl;