2 Copyright 2010 Neil Groves
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 [section:semantics Semantics]
11 [[Type ] [Object] [Describes ]]
12 [[`X` ] [`x` ] [any type ]]
13 [[`T` ] [`t` ] [denotes behavior of the primary templates]]
14 [[`P` ] [`p` ] [denotes `std::pair<iterator,iterator>` ]]
15 [[`A[sz]`] [`a` ] [denotes an array of type `A` of size `sz`]]
16 [[`Char*`] [`s` ] [denotes either `char*` or `wchar_t*` ]]
19 [section Metafunctions]
22 [[Expression] [Return type] [Complexity]]
24 [`range_iterator<X>::type`]
33 [`range_iterator<const X>::type`]
42 [`range_value<X>::type`]
43 [`boost::iterator_value<range_iterator<X>::type>::type`]
47 [`range_reference<X>::type`]
48 [`boost::iterator_reference<range_iterator<X>::type>::type`]
52 [`range_pointer<X>::type`]
53 [`boost::iterator_pointer<range_iterator<X>::type>::type`]
57 [`range_category<X>::type`]
58 [`boost::iterator_category<range_iterator<X>::type>::type`]
62 [`range_difference<X>::type`]
63 [`boost::iterator_difference<range_iterator<X>::type>::type`]
67 [`range_reverse_iterator<X>::type`]
68 [`boost::reverse_iterator<range_iterator<X>::type>`]
72 [`range_reverse_iterator<const X>::type`]
73 [`boost::reverse_iterator<range_iterator<const X>::type`]
77 [`has_range_iterator<X>::type`]
78 [`mpl::true_` if `range_mutable_iterator<X>::type` is a valid expression, `mpl::false_` otherwise]
82 [`has_range_const_iterator<X>::type`]
83 [`mpl::true_` if `range_const_iterator<X>::type` is a valid expression, `mpl::false_` otherwise]
93 [[Expression] [Return type] [Returns] [Complexity]]
97 [`range_iterator<X>::type`]
99 `p.first` if `p` is of type `std::pair<T>`
100 `a` if `a` is an array
101 `range_begin(x)` if that expression would invoke a function found by ADL
102 `t.begin()` otherwise
108 [`range_iterator<X>::type`]
110 `p.second` if `p` is of type `std::pair<T>`
111 `a + sz` if `a` is an array of size `sz`
112 `range_end(x)` if that expression would invoke a function found by ADL
120 [`boost::begin(x) == boost::end(x)`]
125 [`range_difference<X>::type`]
126 [`std::distance(boost::begin(x),boost::end(x))`]
131 [`range_size<X>::type`]
132 [`range_calculate_size(x)` which by default is `boost::end(x) - boost::begin(x)`. Users may supply alternative implementations by implementing `range_calculate_size(x)` so that it will be found via ADL]
137 [`range_reverse_iterator<X>::type`]
138 [`range_reverse_iterator<X>::type(boost::end(x))`]
143 [`range_reverse_iterator<X>::type`]
144 [`range_reverse_iterator<X>::type(boost::begin(x))`]
149 [`range_iterator<const X>::type`]
150 [`range_iterator<const X>::type(boost::begin(x))`]
155 [`range_iterator<const X>::type`]
156 [`range_iterator<const X>::type(boost::end(x))`]
161 [`range_reverse_iterator<const X>::type`]
162 [`range_reverse_iterator<const X>::type(boost::rbegin(x))`]
167 [`range_reverse_iterator<const X>::type`]
168 [`range_reverse_iterator<const X>::type(boost::rend(x))`]
173 [`iterator_range<U>` where `U` is `Char*` if `x` is a pointer to a string and `U` is `range_iterator<X>::type` otherwise]
175 `[s,s + std::char_traits<X>::length(s))` if `s` is a `Char*` or an array of `Char` `[boost::begin(x),boost::end(x))` otherwise
178 linear time for pointers to a string or arrays of `Char`, constant time otherwise
183 [`iterator_range<X>`]
184 [`[boost::begin(x),boost::end(x))`]
188 The special `const_`-named functions are useful when you want to document clearly that your code is read-only.
190 `as_literal()` can be used ['*internally*] in string algorithm libraries such that arrays of characters are handled correctly.
192 `as_array()` can be used with string algorithm libraries to make it clear that arrays of characters are handled like an array and not like a string.
194 Notice that the above functions should always be called with qualification (`boost::`) to prevent ['*unintended*] Argument Dependent Lookup (ADL).