...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;
Notation
An iterator_range type
An instance of First
An instance of Last
Instances of iterator_range
Semantics of an expression is defined only where it differs from, or is not defined in Forward Sequence.
Expression |
Semantics |
---|---|
IR(f, l) |
Creates an iterator_range given iterators, f and l. |
IR(ir) |
Copy constructs an iterator_range from another iterator_range, ir. |
ir = ir2 |
Assigns to a iterator_range, ir, from another iterator_range, ir2. |
char const* s = "Ruby"; typedef vector<int, char, double, char const*> vector_type; vector_type vec(1, 'x', 3.3, s); typedef result_of::begin<vector_type>::type A; typedef result_of::end<vector_type>::type B; typedef result_of::next<A>::type C; typedef result_of::prior<B>::type D; C c(vec); D d(vec); iterator_range<C, D> range(c, d); std::cout << range << std::endl;