Compare commits

...

30 Commits

Author SHA1 Message Date
a4c9c3eb65 Branch at revision 46530
[SVN r46531]
2008-06-19 18:57:10 +00:00
15a697f86b new jamfile to see warnings better
[SVN r46348]
2008-06-12 12:00:57 +00:00
dbef3564c4 fixes from Trac
[SVN r46346]
2008-06-12 10:54:44 +00:00
b948d9af17 fixes for problems from Trac
[SVN r46345]
2008-06-12 10:00:54 +00:00
95d424012b Quote href values - our tools don't support unquoted values.
[SVN r45283]
2008-05-11 13:49:20 +00:00
36a99eb0a0 test of updated as_literal()
[SVN r45124]
2008-05-05 06:42:30 +00:00
f117011b60 fix for as_literal()
[SVN r45123]
2008-05-05 06:41:54 +00:00
7c0d73b8cf fixed problem with operator()() when the value_type was abstract.
[SVN r43322]
2008-02-19 15:10:05 +00:00
405ebd8cca include config.hpp and workaround.hpp before uses of BOOST_WORKAROUND and BOOST_MSVC
[SVN r43220]
2008-02-11 03:48:41 +00:00
94b45ef51e missing ) fixed
[SVN r43175]
2008-02-08 15:25:01 +00:00
e115ac1006 silence of warnings for unused arguments
[SVN r43171]
2008-02-08 09:58:35 +00:00
8b712359a2 test
[SVN r43156]
2008-02-07 14:46:19 +00:00
428e72ed22 iterator_range disables msvc warning 4996
<http://svn.boost.org/trac/boost/ticket/1565>

[range] sub_range assignment issue
    <http://svn.boost.org/trac/boost/ticket/1284> 

[SVN r43155]
2008-02-07 14:41:04 +00:00
73db2a05b6 cleanup to pass inspection tool
[SVN r43135]
2008-02-06 23:12:21 +00:00
507d1e8075 fixed #if to #ifdef
[SVN r42715]
2008-01-13 11:37:41 +00:00
d31787daae doc fixes
[SVN r42693]
2008-01-12 12:38:57 +00:00
14a9a1906b Ticket #1477
[SVN r41638]
2007-12-03 09:08:02 +00:00
f65c137e73 missing include
[SVN r41636]
2007-12-03 09:00:23 +00:00
8085605217 fixed a serious oversigt
[SVN r41457]
2007-11-29 09:19:24 +00:00
0eb365edbe macro patch
[SVN r41183]
2007-11-17 21:24:16 +00:00
2e0d7eab4a removed some warnings
[SVN r41181]
2007-11-17 21:21:53 +00:00
637dc618d1 iostream macro patch
[SVN r41180]
2007-11-17 21:19:13 +00:00
dd1459f221 works after local test with vc8
[SVN r41177]
2007-11-17 20:44:29 +00:00
ba96d075b2 last updates
[SVN r41176]
2007-11-17 20:22:20 +00:00
a2f3a45214 minor update of comments
[SVN r41175]
2007-11-17 20:22:05 +00:00
6ac0cfe09c improved reference
[SVN r40968]
2007-11-09 15:15:28 +00:00
7b3857a9a8 minor tweaks to avoid warnings ... extension mechanism updated to follow new protocol
[SVN r40966]
2007-11-09 13:31:43 +00:00
2605b9ee45 update of new concepts, and replacement of range_size<T>::type with range_difference<T>::type throughut the library
[SVN r40965]
2007-11-09 13:30:57 +00:00
1509d5603b minor editorial issue
[SVN r40964]
2007-11-09 13:13:06 +00:00
93deddde63 major update wrt. new range concepts
[SVN r40962]
2007-11-09 10:27:42 +00:00
86 changed files with 859 additions and 646 deletions

View File

@ -1,3 +1,13 @@
#// Boost.Range library
#//
#// Copyright Thorsten Ottosen 2003-2008. Use, modification and
#// distribution is subject to 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)
#//
#// For more information, see http://www.boost.org/libs/range/
#//
use-project boost : $(BOOST_ROOT) ;

View File

@ -70,6 +70,10 @@ class=identifier>range_iterator</span></a><span class=special>;
</span><span class=keyword>struct </span><a href="#range_value"><span
class=identifier>range_value</span></a><span class=special>;
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a href="#range_reference"><span
class=identifier>range_reference</span></a><span class=special>;
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a href="#range_pointer"><span
class=identifier>range_pointer</span></a><span class=special>;
@ -94,14 +98,6 @@ class=identifier>range_difference</span></a><span class=special>;
</span><span class=keyword>struct </span><a
href="#range_reverse_iterator"><span
class=identifier>range_reverse_iterator</span></a><span class=special>;
</span><span class=comment>//
// Random Access Range metafunctions
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a href="#range_size"><span
class=identifier>range_size</span></a><span class=special>;
</span><span class=comment>//
// Single Pass Range functions
@ -109,23 +105,23 @@ class=identifier>range_size</span></a><span class=special>;
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#begin"><span class=identifier>begin</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><a href="#begin"><span class=identifier>begin</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#begin"><span class=identifier>begin</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#begin"><span class=identifier>begin</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#end"><span class=identifier>end</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><a href="#end"><span class=identifier>end</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#end"><span class=identifier>end</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#end"><span class=identifier>end</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>bool
</span><a href="#empty"><span class=identifier>empty</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><a href="#empty"><span class=identifier>empty</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=comment>//
// Forward Range functions
@ -133,7 +129,7 @@ class=identifier>range_size</span></a><span class=special>;
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_difference</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#size"><span class=identifier>distance</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><a href="#size"><span class=identifier>distance</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=comment>//
// Bidirectional Range functions
@ -141,30 +137,29 @@ class=identifier>range_size</span></a><span class=special>;
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#rbegin"><span class=identifier>rbegin</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><a href="#rbegin"><span class=identifier>rbegin</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#rbegin"><span class=identifier>rbegin</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#rbegin"><span class=identifier>rbegin</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#rend"><span class=identifier>rend</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><a href="#rend"><span class=identifier>rend</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#rend"><span class=identifier>rend</span></a><span class=special>( </span><span class=keyword>const </span><span
class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span>
</span><span class=comment>//
// Random Access Range functions
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_size</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#size"><span class=identifier>size</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>c </span><span class=special>);
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_difference</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#size"><span class=identifier>size</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);</span>
<span class=comment>//
// Special const Range functions
//
@ -185,6 +180,26 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type </span>
<a href="#const_rend"><span class=identifier>const_rend</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);</span>
<span class=comment>//
// String utilities
//</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt;...</span><span class=identifier>see</span> <span class=identifier>below</span><span class=special>...&gt;</span>
<span class=identifier><a href="#as_literal">as_literal</a></span><span class=special>(</span> <span class=identifier>T</span><span class=special>&amp;</span> <span class=identifier>r</span> <span class=special>);</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt;...</span><span class=identifier>see</span> <span class=identifier>below</span><span class=special>...&gt;</span>
<span class=identifier><a href="#as_array">as_literal</a></span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>T</span><span class=special>&amp;</span> <span class=identifier>r</span> <span class=special>);</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt;</span> <span class=keyword>typename</span> <span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type</span> <span class=special>&gt;</span>
<span class=identifier><a href="#as_array">as_array</a></span><span class=special>(</span> <span class=identifier>T</span><span class=special>&amp;</span> <span class=identifier>r</span> <span class=special>);</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt;</span> <span class=keyword>typename</span> <span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const</span> <span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type</span> <span class=special>&gt;</span>
<span class=identifier><a href="#as_literal">as_array</a></span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>T</span><span class=special>&amp;</span> <span class=identifier>r</span> <span class=special>);</span>
<span class=special>} </span><span class=comment>// namespace 'boost'
</span>
</pre>
@ -244,88 +259,79 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<th>
Complexity</th>
</tr>
<tr>
<a name="range_value"></a>
<td><code>range_value&lt;X&gt;::type</code></td>
<td><code>T::value_type</code><br>
<code>boost::iterator_value&lt;P::first_type&gt;::type</code> <!--if <code>P</code> is an instantiation of <code>std::pair</code>--><br>
<code>A</code><br>
<code>Char</code>
<td>compile time</td>
</tr>
<tr>
<a name="range_iterator"></a>
<td><code>range_iterator&lt;X&gt;::type</code></td>
<td><code>T::iterator</code><br>
<code>P::first_type</code><br>
<code>A*</code><br>
<code>Char*</code>
<td>compile time</td>
</tr>
<tr>
<a name="range_const_iterator"></a>
<td><code>range_const_iterator&lt;X&gt;::type</code></td>
<td><code>range_iterator&lt;const X&gt;::type</code></td>
<td><code>T::const_iterator</code><br>
<code>P::first_type</code><br>
<code>const A*</code><br>
<code>const Char*</code>
<td>compile time</td>
</tr>
<tr>
<a name="range_value"></a>
<td><code>range_value&lt;X&gt;::type</code></td>
<td><code>boost::iterator_value&lt;range_iterator&lt;X&gt;::type&gt;::type</code>
</td>
<td>compile time</td>
</tr>
<tr>
<a name="range_reference"></a>
<td><code>range_reference&lt;X&gt;::type</code></td>
<td><code>boost::iterator_reference&lt;range_iterator&lt;X&gt;::type&gt;::type</code>
</td>
<td>compile time</td>
</tr>
<tr>
<a name="range_pointer"></a>
<td><code>range_pointer&lt;X&gt;::type</code></td>
<td><code>boost::iterator_pointer&lt;range_iterator&lt;X&gt;::type&gt;::type</code>
</td>
<td>compile time</td>
</tr>
<tr>
<a name="range_category"></a>
<td><code>range_category&lt;X&gt;::type</code></td>
<td><code>boost::iterator_category&lt;range_iterator&lt;X&gt;::type&gt;::type</code>
</td>
<td>compile time</td>
</tr>
<tr>
<a name="range_difference"></a>
<td><code>range_difference&lt;X&gt;::type</code></td>
<td><code>T::difference_type</code><br>
<code>boost::iterator_difference&lt;P::first_type&gt;::type</code><br>
<code>std::ptrdiff_t</code><br>
<code>std::ptrdiff_t</code><br>
<td>
<code>boost::iterator_difference&lt;range_iterator&lt;X&gt;::type&gt;::type</code></td>
<td>compile time</td>
</tr>
<tr>
<a name="range_size"></a>
<td><code>range_size&lt;X&gt;::type</code></td>
<td><code>T::size_type</code><br>
<code>std::size_t</code><br>
<code>std::size_t</code><br>
<code>std::size_t</code><br>
<td>compile time</td>
</tr>
<tr>
<a name="range_result_iterator"></a>
<td><code>range_result_iterator&lt;X&gt;::type</code></td>
<td><code>range_const_iterator&lt;X&gt;::type</code> if <code>X</code> is <code>const</code>
<br>
<code>range_iterator&lt;X&gt;::type</code> otherwise
</td>
<td>compile time</td>
</tr>
<tr>
<a name="range_reverse_iterator"></a>
<td><code>range_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>boost::reverse_iterator&lt; typename range_iterator&lt;T&gt;::type &gt;</code><br>
<td><code>boost::reverse_iterator&lt;range_iterator&lt;X&gt;::type&gt;</code><br>
<td>compile time</td>
</tr>
<tr>
<a name="range_const_reverse_iterator"></a>
<td><code>range_const_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>boost::reverse_iterator&lt; typename range_const_iterator&lt;T&gt;::type &gt;</code>
<td><code>range_reverse_iterator&lt;const X&gt;::type</code></td>
<td><code>boost::reverse_iterator&lt;range_iterator&lt;const X&gt;::type&gt;</code>
<br>
<td>compile time</td>
</tr>
<tr>
<a name="range_reverse_result_iterator"></a>
<td><code>range_reverse_result_iterator&lt;X&gt;::type</code></td>
<td><code>boost::reverse_iterator&lt; typename range_result_iterator&lt;T&gt;::type
&gt;</code>
<td>compile time</td>
</tr>
</table>
</p>
<p>
The special metafunctions <code>range_result_iterator</code> and <code>range_reverse_result_iterator</code>
are not part of any Range concept, but they are very useful when implementing
certain Range classes like <a href="utility_class.html#sub_range"><code>sub_range</code></a>
because of their ability to select iterators based on constness.
</p>
<h4>Functions</h4>
<p>
<table border="1" cellpadding="5">
@ -342,12 +348,11 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<tr>
<a name="begin"></a>
<td><code>begin(x)</code></td>
<td><code>range_result_iterator&lt;X&gt;::type</code></td>
<td><code>range_iterator&lt;X&gt;::type</code></td>
<td>
<code>p.first</code> if <code>p</code> is of type <code>std::pair&ltT&gt;<code><br>
<code>a</code> if <code>a</code> is an array <br>
<code>s</code> if <code>s</code> is a string literal<br>
<code>boost_range_begin(x)</code> if that expression would invoke a function found by ADL <br>
<code>range_begin(x)</code> if that expression would invoke a function found by ADL <br>
<code>t.begin()</code> otherwise
<td>constant time</td>
@ -355,106 +360,155 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<tr>
<a name="end"></a>
<td><code>end(x)</code></td>
<td><code>range_result_iterator&lt;X&gt;::type</code></td>
<td><code>range_iterator&lt;X&gt;::type</code></td>
<td>
<code>p.second</code> if <code>p</code> is of type <code>std::pair&ltT&gt;<code><br>
<code>a + sz</code> if <code>a</code> is an array of size <code>sz</code><br>
<code>s + std::char_traits&lt;X&gt;::length( s )</code> if <code>s</code> is a <code>Char*</code>
<code>a + sz</code> if <code>a</code> is an array of size <code>sz</code>
<br>
<code>s + sz - 1</code> if <code>s</code> is a string literal of size <code>sz</code>
<br>
<code>boost_range_end(x)</code> if that expression would invoke a function found by ADL <br>
<code>range_end(x)</code> if that expression would invoke a function found by ADL <br>
<code>t.end()</code> otherwise
<td>linear if <code>X</code> is <code>Char*</code>
<br>
constant time otherwise</td>
<td>
constant time </td>
</tr>
<tr>
<a name="empty"></a>
<td><code>empty(x)</code></td>
<td><code>bool</code></td>
<td><code>begin(x) == end( x )</code><br>
<td>linear if <code>X</code> is <code>Char*</code>
<br>
constant time otherwise<br>
<td><code>boost::begin(x) == boost::end(x)</code><br>
<td> constant time <br>
</td>
</tr>
<tr>
<a name="distance"></a>
<td><code>distance(x)</code></td>
<td><code>range_difference&lt;X&gt;::type</code></td>
<td>
<code>
std::distance(boost::begin(x),boost::end(x))
</code>
</td>
<td>-</td>
</tr>
<tr>
<a name="size"></a>
<td><code>size(x)</code></td>
<td><code>range_size&lt;X&gt;::type</code></td>
<td>
<code>std::distance(p.first,p.second)</code> if <code>p</code> is of type <code>std::pair&ltT&gt;<code><br>
<code>sz</code> if <code>a</code> is an array of size <code>sz</code><br>
<code>end(s) - s</code> if <code>s</code> is a string literal or a <code>Char*</code><br>
<code>boost_range_size(x)</code> if that expression would invoke a function found by ADL <br>
<code>t.size()</code> otherwise
<td>linear if <code>X</code> is <code>Char*</code>
<br>
or if <code>std::distance()</code> is linear
<br>
constant time otherwise</td>
<td><code>range_difference&lt;X&gt;::type</code></td>
<td><code> boost::end(x) - boost::begin(x)</code>
<td> constant time </td>
</tr>
<tr>
<a name="rbegin"></a>
<td><code>rbegin(x)</code></td>
<td><code>range_reverse_result_iterator&lt;X&gt;::type</code></td>
<td><code>range_reverse_result_iterator&lt;X&gt;::type( end(x) )</code>
<td><code>range_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>range_reverse_iterator&lt;X&gt;::type( boost::end(x) )</code>
<br>
<td>same as <code>end(x)</code>
<td>constant time
</td>
</tr>
<tr>
<a name="rend"></a>
<td><code>rend(x)</code></td>
<td><code>range_reverse_result_iterator&lt;X&gt;::type</code></td>
<td><code>range_reverse_result_iterator&lt;X&gt;::type( begin(x) )</code>
<td>same as <code>begin(x)</code></td>
<td><code>range_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>range_reverse_iterator&lt;X&gt;::type( boost::begin(x) )</code>
<td>constant time</td>
</tr>
<tr>
<a name="const_begin"></a>
<td><code>const_begin(x)</code></td>
<td><code>range_const_iterator&lt;X&gt;::type</code></td>
<td><code>range_const_iterator&lt;X&gt;::type( begin(x) )</code>
<td><code>range_iterator&lt;const X&gt;::type</code></td>
<td><code>range_iterator&lt;const X&gt;::type( boost::begin(x) )</code>
<br>
<td>same as <code>begin(x)</code>
<td>constant time
</td>
</tr>
<tr>
<a name="const_end"></a>
<td><code>const_end(x)</code></td>
<td><code>range_const_iterator&lt;X&gt;::type</code></td>
<td><code>range_const_iterator&lt;X&gt;::type( end(x) )</code>
<td>same as <code>end(x)</code></td>
<td><code>range_iterator&lt;const X&gt;::type</code></td>
<td><code>range_iterator&lt;const X&gt;::type( boost::end(x) )</code>
<td>constant time</td>
</tr>
<tr>
<a name="const_rbegin"></a>
<td><code>const_rbegin(x)</code></td>
<td><code>range_const_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>range_const_reverse_iterator&lt;X&gt;::type( rbegin(x) )</code>
<td><code>range_reverse_iterator&lt;const X&gt;::type</code></td>
<td><code>range_reverse_iterator&lt;const X&gt;::type( boost::rbegin(x) )</code>
<br>
<td>same as <code>rbegin(x)</code>
<td>constant time
</td>
</tr>
<tr>
<a name="const_rend"></a>
<td><code>const_rend(x)</code></td>
<td><code>range_const_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>range_const_reverse_iterator&lt;X&gt;::type( rend(x) )</code>
<td>same as <code>rend(x)</code></td>
<td><code>range_reverse_iterator&lt;const X&gt;::type</code></td>
<td><code>range_reverse_iterator&lt;const X&gt;::type( boost::rend(x) )</code>
<td>constant time</td>
</tr>
<tr>
<a name="as_literal"></a>
<td><code>as_literal(x)</code></td>
<td><code>iterator_range&lt;U></code> where <code>U</code> is
<code>Char*</code> if <code>x</code> is a pointer to a
string and <code>U</code> is
<code>range_iterator&lt;X>::type</code> otherwise
</td>
<td>
<code>[a,a+sz-1)</code> if <code>a</code> is an array of size <code>sz</code><br>
<code>[s,s + std::char_traits&lt;X&gt;::length(s))</code> if <code>s</code> is a <code>Char*</code>
<br>
<code>[boost::begin(x),boost::end(x))</code> otherwise
</td>
<td>linear time for pointers to a string, constant time
otherwise</td>
</tr>
<tr>
<a name="as_array"></a>
<td><code>as_array(x)</code></td>
<td><code>iterator_range&lt;X></code> </td>
<td>
<code>[boost::begin(x),boost::end(x))</code>
</td>
<td>constant time otherwise</td>
</tr>
</table>
</p>
<p>
The special <code>const</code> functions are not part of any Range concept, but
are very useful when you want to document clearly that your code is read-only.
The special <code>const_</code>-named functions are useful when you
want to document clearly that your code is read-only.
</p>
<p>
<code>as_literal()</code> can be used <i>internally</i> in string
algorithm librararies such that arrays of characters are
handled correctly.
</p>
<p>
<code>as_array()</code> 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.
</p>
<p>Notice that the above functions should always be called with
qualification (<code>boost::</code>) to prevent <i>unintended</i>
Argument Dependent Lookup (ADL).
</p>
<hr>
<a name="minimal_interface"></a>
<h3>Extending the library</h3>
<ul>
<li><a href="#method1">Method 1: provide member functions and nested types</a></li>
<li><a href="#method2">Method 2: provide free-standing functions and specialize metafunctions</a></li>
</ul>
@ -491,10 +545,6 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
</td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>size()</code></td>
<td><a href="range.html#forward_range">Forward Range</a></td>
</tr>
</table>
</p>
<p>
@ -520,10 +570,6 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<td><code>const_iterator</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>size_type</code></td>
<td><a href="range.html#forward_range">Forward Range</a></td>
</tr>
</table>
</p>
<p>
@ -554,26 +600,23 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<th>
Related concept</th>
<tr>
<td><code>boost_range_begin(x)</code></td>
<td><code>range_begin(x)</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>boost_range_end(x)</code>
<td><code>range_end(x)</code>
</td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>boost_range_size(x)</code></td>
<td><a href="range.html#forward_range">Forward Range</a></td>
</tr>
</table>
</p>
<p><code>boost_range_begin()</code> and <code>boost_range_end()</code> must be
<p><code>range_begin()</code> and <code>range_end()</code> must be
overloaded for both <code>const</code> and mutable reference arguments.
</p>
<p>
You must also specialize 3 metafunctions for your type <code>X</code>:
You must also specialize two metafunctions for your type <code>X</code>:
</p>
<p>
<table cellpadding="5" border="1" ID="Table2">
@ -583,17 +626,14 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<th>
Related concept</th>
<tr>
<td><code>boost::range_iterator</code></td>
<td><code>boost::range_mutable_iterator</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>boost::range_const_iterator</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>boost::range_size</code></td>
<td><a href="range.html#forward_range">Forward Range</a></td>
</tr>
</table>
</p>
<p>
@ -627,7 +667,7 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
//</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>struct</span> <span class=identifier>range_iterator</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;</span> <span class=special>&gt;</span>
<span class=keyword>struct</span> <span class=identifier>range_mutable_iterator</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;</span> <span class=special>&gt;</span>
<span class=special>{</span>
<span class=keyword>typedef</span> <span class=identifier>T</span> <span class=identifier>type</span><span class=special>;</span>
<span class=special>};</span>
@ -636,20 +676,13 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<span class=keyword>struct</span> <span class=identifier>range_const_iterator</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;</span> <span class=special>&gt;</span>
<span class=special>{</span>
<span class=comment>//
// Remark: this is defined similar to 'range_iterator'
// Remark: this is defined similar to 'range_mutable_iterator'
// because the 'Pair' type does not distinguish
// between an iterator and a const_iterator.
//</span>
<span class=keyword>typedef</span> <span class=identifier>T</span> <span class=identifier>type</span><span class=special>;</span>
<span class=special>};</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>struct</span> <span class=identifier>range_size</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;</span> <span class=special>&gt;</span>
<span class=special>{</span>
<span class=keyword>typedef</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>size_t</span> <span class=identifier>type</span><span class=special>;</span>
<span class=special>};</span>
<span class=special>}</span> <span class=comment>// namespace 'boost'</span>
<span class=keyword>namespace</span> <span class=identifier>Foo</span>
@ -661,36 +694,29 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
//</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>boost_range_begin</span><span class=special>(</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>range_begin</span><span class=special>(</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>x</span><span class=special>.</span><span class=identifier>first</span><span class=special>;</span>
<span class=special>}</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>boost_range_begin</span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>range_begin</span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>x</span><span class=special>.</span><span class=identifier>first</span><span class=special>;</span>
<span class=special>}</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>boost_range_end</span><span class=special>(</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>range_end</span><span class=special>(</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>x</span><span class=special>.</span><span class=identifier>last</span><span class=special>;</span>
<span class=special>}</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>boost_range_end</span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>range_end</span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>x</span><span class=special>.</span><span class=identifier>last</span><span class=special>;</span>
<span class=special>}</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>inline</span> <span class=keyword>typename</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_size</span><span class=special>&lt;</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;</span> <span class=special>&gt;::</span><span class=identifier>type</span>
<span class=identifier>boost_range_size</span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>distance</span><span class=special>(</span><span class=identifier>x</span><span class=special>.</span><span class=identifier>first</span><span class=special>,</span><span class=identifier>x</span><span class=special>.</span><span class=identifier>last</span><span class=special>);</span>
<span class=special>}</span>
<span class=special>}</span> <span class=comment>// namespace 'Foo'</span>
<span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>vector</span><span class=special>&gt;</span>
@ -699,7 +725,7 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<span class=special>{</span>
<span class=keyword>typedef</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>vector</span><span class=special>&lt;</span><span class=keyword>int</span><span class=special>&gt;::</span><span class=identifier>iterator</span> <span class=identifier>iter</span><span class=special>;</span>
<span class=identifier>std</span><span class=special>::</span><span class=identifier>vector</span><span class=special>&lt;</span><span class=keyword>int</span><span class=special>&gt;</span> <span class=identifier>vec</span><span class=special>;</span>
<span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;</span> <span class=identifier>pair</span> <span class=special>=</span> <span class=special>{</span> <span class=identifier>vec</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(),</span> <span class=identifier>vec</span><span class=special>.</span><span class=identifier>end</span><span class=special>()</span> <span class=special>};</span>
<span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;</span> <span class=identifier>pair</span> <span class=special>=</span> <span class=special>{</span> <span class=identifier>vec</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(),</span> <span class=identifier>vec</span><span class=special>.</span><span class=identifier>end</span><span class=special>()</span> <span class=special>};</span>
<span class=keyword>const</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;&amp;</span> <span class=identifier>cpair</span> <span class=special>=</span> <span class=identifier>pair</span><span class=special>;</span>
<span class=comment>//
// Notice that we call 'begin' etc with qualification.
@ -708,9 +734,9 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<span class=identifier>iter</span> <span class=identifier>e</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>end</span><span class=special>(</span> <span class=identifier>pair</span> <span class=special>);</span>
<span class=identifier>i</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>begin</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>);</span>
<span class=identifier>e</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>end</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>);</span>
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_size</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;</span> <span class=special>&gt;::</span><span class=identifier>type</span> <span class=identifier>s</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>size</span><span class=special>(</span> <span class=identifier>pair</span> <span class=special>);</span>
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_difference</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;</span> <span class=special>&gt;::</span><span class=identifier>type</span> <span class=identifier>s</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>size</span><span class=special>(</span> <span class=identifier>pair</span> <span class=special>);</span>
<span class=identifier>s</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>size</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>);</span>
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_const_reverse_iterator</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;</span> <span class=special>&gt;::</span><span class=identifier>type</span>
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span> <span class=identifier>const Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;</span> <span class=special>&gt;::</span><span class=identifier>type</span>
<span class=identifier>ri</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>rbegin</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>),</span>
<span class=identifier>re</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>rend</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>);</span>
<span class=special>}</span>
@ -719,7 +745,13 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2004
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>

View File

@ -1,3 +1,13 @@
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2008. Use, modification and
// distribution is subject to 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)
//
// For more information, see http://www.boost.org/libs/range/
//
#include <boost/range.hpp>
#include <iterator> // for std::iterator_traits, std::distance()

13
doc/examples.html Executable file → Normal file
View File

@ -26,10 +26,6 @@
</li>
shows how to implement a container version of <code >std::find()</code> that
works with <code >char[],wchar_t[],char*,wchar_t*.</code>
<p>
<b>Warning:</b><i> support for null-terminated strings is deprecated and will
disappear in the next Boost release (1.34). </i>
</p>
<li >
<a href="../test/algorithm_example.cpp" target="_self" ><code >algorithm_example.cpp</code></a>
@ -45,9 +41,16 @@
<li> <a href="../test/array.cpp">array.cpp</a>
</ul>
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2004
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>

11
doc/faq.html Executable file → Normal file
View File

@ -114,9 +114,16 @@ Cool indeed!
</ol>
<hr>
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2004
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>

30
doc/headers.html Executable file → Normal file
View File

@ -50,7 +50,7 @@
>range_iterator</a></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a> </td>
</tr>
<tr >
<tr >
<td ><code >&lt;boost/range/mutable_iterator.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_mutable_iterator"
>range_mutable_iterator</a></td>
@ -69,20 +69,15 @@
<td><a href="range.html#forward_range">Forward Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/size_type.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_size" >range_size</a></td>
<td><a href="range.html#forward_range">Forward Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/pointer.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_pointer"
>range_pointer</a></td>
>range_pointer</a></td>
<td>- </td>
</tr>
<tr >
<tr >
<td ><code >&lt;boost/range/category.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_category"
>range_category</a></td>
>range_category</a></td>
<td>- </td>
</tr>
@ -112,7 +107,7 @@
<td ><a href="boost_range.html#empty" >empty</a></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a> </td>
</tr>
<tr >
<tr >
<td ><code >&lt;boost/range/distance.hpp&gt;</code></td>
<td ><a href="boost_range.html#distance" >distance</a></td>
<td><a href="range.html#forward_range">Forward Range</a> </td>
@ -121,7 +116,7 @@
<td ><code >&lt;boost/range/size.hpp&gt;</code></td>
<td ><a href="boost_range.html#size" >size</a></td>
<td><a href="range.html#random_access_range">Random Access Range</a>
</td>
</td>
</tr>
<tr >
<td ><code >&lt;boost/range/rbegin.hpp&gt;</code></td>
@ -139,14 +134,14 @@
</td>
<td><a href="range.html#bidirectional_range">Bidirectional Range</a> </td>
</tr>
<tr >
<tr >
<td ><code >&lt;boost/range/as_array.hpp&gt;</code></td>
<td >
<a href="boost_range.html#as_array" >as_array</a>
</td>
<td>-</td>
</tr>
<tr >
<tr >
<td ><code >&lt;boost/range/as_literal.hpp&gt;</code></td>
<td >
<a href="boost_range.html#as_literal" >as_literal</a>
@ -178,7 +173,14 @@
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2004
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>

17
doc/history_ack.html Executable file → Normal file
View File

@ -18,10 +18,10 @@
<h2 >History and Acknowledgement</h2><a name="History" ></a>
<p >
The library have been under way for a long time. Dietmar K<>hl originally
intended to submit an <code >array_traits</code> class template which
had most of the functionality present now, but only for arrays and standard
containers.
The library was under way for a long time. Dietmar K<>hl originally intended
to submit an <code >array_traits</code> class template which had most of
the functionality present now, but only for arrays and standard containers.
I believe this was back in 2001 or 2002.
</p>
<p>
@ -61,7 +61,14 @@ C++ standard: <blockquote>
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2006
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>

24
doc/intro.html Executable file → Normal file
View File

@ -24,7 +24,7 @@
to a somewhat clumsy use of the algorithms with redundant specification
of container names. Therefore we would like to raise the abstraction level
for algorithms so they specify their interface in terms of <a
href=range.html>Ranges</a> as much as possible.
href="range.html">Ranges</a> as much as possible.
</p>
<p>
@ -35,16 +35,14 @@
enough functionality to satisfy the needs of the generic code
<i>if a suitable layer of indirection is applied </i>. For
example, raw arrays are often suitable for use with generic code that
works with containers, provided a suitable adapter is used. Likewise, null
terminated strings can be treated as containers of characters, if suitably
adapted.
works with containers, provided a suitable adapter is used.
</p>
<p>
This library therefore provides the means to adapt standard-like
containers,
null terminated strings, <code>std::pairs</code> of iterators, and raw
arrays (and more), such that the same generic code can work with them all.
containers, <code>std::pairs</code> of iterators, and raw arrays (and
more), such that
the same generic code can work with them all.
The basic idea is to add another layer of indirection using <a
href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a> and
free-standing functions so syntactic and/or semantic differences can be removed.
@ -65,8 +63,7 @@ free-standing functions so syntactic and/or semantic differences can be removed.
</ul>
</p>
<p >
Below are given a small example (the complete example can be found <a
<p > Below is given a small example (the complete example can be found <a
href="../test/algorithm_example.cpp" target="_self" >here</a>): <blockquote>
<pre >
<span class=comment>
@ -138,7 +135,14 @@ Notice that we have to
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2007
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>

View File

@ -3,14 +3,289 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<title>Boost Range MFC/ATL Extension</title>
<meta name="author" content="Shunsuke Sogame" />
<meta name="date" content="26th of May 2006" />
<meta name="copyright" content="Shunsuke Sogame 2005-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt)." />
<style type="text/css">
@import "http://www.boost.org/libs/ptr_container/doc/default.css";
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date: 2005-09-25 17:49:54 +0200 (Sun, 25 Sep 2005) $
:Revision: $Revision: 3901 $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
.first {
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-right {
clear: right }
img.borderless {
border: 0 }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid thin gray }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
</style>
</head>
@ -33,7 +308,7 @@
</table>
<div class="section">
<h1><a id="overview" name="overview">Overview</a></h1>
<p>Boost.Range MFC/ATL Extension provides <a class="reference" href="http://www.boost.org/libs/range/">Boost.Range</a> support for MFC/ATL collection and string types.</p>
<p>Boost.Range MFC/ATL Extension provides <a class="reference" href="../index.html">Boost.Range</a> support for MFC/ATL collection and string types.</p>
<pre class="literal-block">
CTypedPtrArray&lt;CPtrArray, CList&lt;CString&gt; *&gt; myArray;
...
@ -64,7 +339,7 @@ BOOST_FOREACH (CList&lt;CString&gt; *theList, myArray)
</div>
<div class="section">
<h1><a id="mfc-ranges" name="mfc-ranges">MFC Ranges</a></h1>
<p>If the <tt class="docutils literal"><span class="pre">&lt;boost/range/mfc.hpp&gt;</span></tt> is included before or after <a class="reference" href="http://www.boost.org/libs/range/">Boost.Range</a> headers,
<p>If the <tt class="docutils literal"><span class="pre">&lt;boost/range/mfc.hpp&gt;</span></tt> is included before or after <a class="reference" href="../index.html">Boost.Range</a> headers,
the MFC collections and strings become models of Range.
The table below lists the Traversal Category and <tt class="docutils literal"><span class="pre">range_reference</span></tt> of MFC ranges.</p>
<table border="1" class="docutils">
@ -170,7 +445,7 @@ The table below lists the Traversal Category and <tt class="docutils literal"><s
</tr>
</tbody>
</table>
<p>Other <a class="reference" href="http://www.boost.org/libs/range/">Boost.Range</a> metafunctions are defined by the following.
<p>Other <a class="reference" href="../index.html">Boost.Range</a> metafunctions are defined by the following.
Let <tt class="docutils literal"><span class="pre">Range</span></tt> be any type listed above and <tt class="docutils literal"><span class="pre">ReF</span></tt> be the same as <tt class="docutils literal"><span class="pre">range_reference&lt;Range&gt;::type</span></tt>.
<tt class="docutils literal"><span class="pre">range_value&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">remove_reference&lt;remove_const&lt;Ref&gt;::type&gt;::type</span></tt>,
<tt class="docutils literal"><span class="pre">range_difference&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">std::ptrdiff_t</span></tt>, and
@ -179,7 +454,7 @@ As for <tt class="docutils literal"><span class="pre">const</span> <span class="
</div>
<div class="section">
<h1><a id="atl-ranges" name="atl-ranges">ATL Ranges</a></h1>
<p>If the <tt class="docutils literal"><span class="pre">&lt;boost/range/atl.hpp&gt;</span></tt> is included before or after <a class="reference" href="http://www.boost.org/libs/range/">Boost.Range</a> headers,
<p>If the <tt class="docutils literal"><span class="pre">&lt;boost/range/atl.hpp&gt;</span></tt> is included before or after <a class="reference" href="../index.html">Boost.Range</a> headers,
the ATL collections and strings become models of Range.
The table below lists the Traversal Category and <tt class="docutils literal"><span class="pre">range_reference</span></tt> of ATL ranges.</p>
<table border="1" class="docutils">
@ -265,7 +540,7 @@ The table below lists the Traversal Category and <tt class="docutils literal"><s
</tr>
</tbody>
</table>
<p>Other <a class="reference" href="http://www.boost.org/libs/range/">Boost.Range</a> metafunctions are defined by the following.
<p>Other <a class="reference" href="../index.html">Boost.Range</a> metafunctions are defined by the following.
Let <tt class="docutils literal"><span class="pre">Range</span></tt> be any type listed above and <tt class="docutils literal"><span class="pre">ReF</span></tt> be the same as <tt class="docutils literal"><span class="pre">range_reference&lt;Range&gt;::type</span></tt>.
<tt class="docutils literal"><span class="pre">range_value&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">remove_reference&lt;Ref&gt;::type</span></tt>,
<tt class="docutils literal"><span class="pre">range_difference&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">std::ptrdiff_t</span></tt>, and
@ -288,7 +563,7 @@ else if (there is a type X such that X* const is the same as ReF)
else
return ReF
</pre>
<p>Other <a class="reference" href="http://www.boost.org/libs/range/">Boost.Range</a> metafunctions are defined by the following.
<p>Other <a class="reference" href="../index.html">Boost.Range</a> metafunctions are defined by the following.
<tt class="docutils literal"><span class="pre">range_value&lt;const</span> <span class="pre">Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">range_value&lt;Range&gt;::type</span></tt>,
<tt class="docutils literal"><span class="pre">range_difference&lt;const</span> <span class="pre">Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">std::ptrdiff_t</span></tt>, and
<tt class="docutils literal"><span class="pre">range_pointer&lt;const</span> <span class="pre">Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">add_pointer&lt;remove_reference&lt;range_reference&lt;const</span> <span class="pre">Range&gt;::type&gt;::type&gt;::type</span></tt>.</p>
@ -296,18 +571,11 @@ else
<div class="section">
<h1><a id="references" name="references">References</a></h1>
<ul class="simple">
<li><a class="reference" href="http://www.boost.org/libs/range/">Boost.Range</a></li>
<li><a class="reference" href="../index.html">Boost.Range</a></li>
<li><a class="reference" href="http://msdn2.microsoft.com/en-us/library/942860sh.aspx">MFC Collections</a></li>
<li><a class="reference" href="http://msdn2.microsoft.com/en-US/library/15e672bd.aspx">ATL Collection Classes</a></li>
</ul>
</div>
</div>
<div class="footer">
<hr class="footer" />
<a class="reference" href="mfc_atl.rst">View document source</a>.
Generated on: 2006-06-04 22:37 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
</body>
</html>

View File

@ -225,8 +225,8 @@ __ http://msdn2.microsoft.com/en-US/library/15e672bd.aspx
.. _Boost C++ Libraries: http://www.boost.org/
.. _Boost: `Boost C++ Libraries`_
.. _Boost.Range: http://www.boost.org/libs/range/
.. _forward: http://www.boost.org/libs/range/doc/range.html#forward_range
.. _bidirectional: http://www.boost.org/libs/range/doc/range.html#forward_range
.. _random access: http://www.boost.org/libs/range/doc/range.html#random_access_range
.. _Boost.Range: ../index.html
.. _forward: range.html#forward_range
.. _bidirectional: range.html#forward_range
.. _random access: range.html#random_access_range

15
doc/portability.html Executable file → Normal file
View File

@ -35,8 +35,8 @@ href="http://boost.sourceforge.net/regression-logs/developer/range.html">here</a
</p>
<p >
Notice also that some compilers cannot do function template ordering properly.
In that case one must rely of <a
href="boost_range.html#range_result_iterator"><code >range_result_iterator</code></a>
In that case one must rely on <a
href="boost_range.html#range_iterator"><code >range_iterator</code></a>
and a single function definition instead of overloaded versions for const and
non-const arguments.
@ -73,11 +73,18 @@ href="http://boost.sourceforge.net/regression-logs/developer/range.html">here</a
</ol>
</p>
<hr>
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2004
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>>
<br>
<br>
<br>

243
doc/range.html Executable file → Normal file
View File

@ -50,7 +50,7 @@
Range provides iterators for accessing a half-open range
<code>[first,one_past_last)</code> of elements and provides
information about the number of elements in the Range. However, a Range has
fewer requirements than a Container.
<i>much</i> fewer requirements than a Container.
</p>
<p>
The motivation for the Range concept is
@ -78,9 +78,9 @@
The operations that can be performed on a Range is dependent on the
<a href="../../iterator/doc/new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal">traversal
category</a> of the underlying iterator type. Therefore
the range concepts are named to reflect which traversal category its
iterators support. See also <a href="style.html">terminology and style guidelines.</a>
for more information about naming of ranges.</p>
the range concepts are named to reflect which traversal category their
iterators support. See also <a href="style.html">terminology and style
guidelines.</a> for more information about naming of ranges.</p>
<p> The concepts described below specifies associated types as
<a href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a> and all
@ -118,11 +118,7 @@ Single Pass Iterator</a>
<h3>Associated types</h3>
<table border="1" cellpadding="5">
<TR>
<TD VAlign="top">Value type</TD>
<TD VAlign="top"><code>boost::range_value&lt;X>::type</code></TD>
<TD VAlign="top">The type of the object stored in a Range.
</TR>
<TR>
<TD VAlign="top">Iterator type</TD>
<TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code></TD>
@ -132,7 +128,7 @@ Single Pass Iterator</a>
</TR>
<TR>
<TD VAlign="top">Const iterator type</TD>
<TD VAlign="top"><code>boost::range_const_iterator&lt;X>::type</code></TD>
<TD VAlign="top"><code>boost::range_iterator&lt;const X>::type</code></TD>
<TD VAlign="top">A type of iterator that may be used to examine, but not to
modify, a Range's elements.</TD>
</TR>
@ -161,20 +157,16 @@ Single Pass Iterator</a>
<TD VAlign="top">Beginning of range</TD>
<TD VAlign="top"><code>boost::begin(a)</code></TD>
<TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code> if
<code>a</code> is mutable, <code>boost::range_const_iterator&lt;X>::type</code>
<code>a</code> is mutable, <code>boost::range_iterator&lt;const X>::type</code>
otherwise</TD> </TR>
<TR>
<TD VAlign="top">End of range</TD>
<TD VAlign="top"><code>boost::end(a)</code></TD>
<TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code> if
<code>a</code> is mutable, <code>boost::range_const_iterator&lt;X>::type</code>
<code>a</code> is mutable, <code>boost::range_iterator&lt;const X>::type</code>
otherwise</TD>
</TR>
<tr>
<TD VAlign="top">Is range empty?</TD>
<TD VAlign="top"><code>boost::empty(a)</code></TD>
<TD VAlign="top">Convertible to <code>bool</code></TD>
</TR>
</table>
<h3>Expression semantics</h3>
@ -188,7 +180,7 @@ otherwise</TD>
<TD VAlign="top"><code>boost::begin(a)</code></TD>
<TD VAlign="top">Returns an iterator pointing to the first element in the Range.</TD>
<TD VAlign="top"><code>boost::begin(a)</code> is either dereferenceable or past-the-end.
It is past-the-end if and only if <code>boost::size(a) == 0</code>.</TD>
It is past-the-end if and only if <code>boost::distance(a) == 0</code>.</TD>
</TR>
<TR>
<TD VAlign="top"><code>boost::end(a)</code></TD>
@ -196,19 +188,14 @@ otherwise</TD>
Range.</TD>
<TD VAlign="top"><code>boost::end(a)</code> is past-the-end.</TD>
</TR>
<TR>
<TD VAlign="top"><code>boost::empty(a)</code></TD>
<TD VAlign="top">Equivalent to <code>boost::begin(a) == boost::end(a)</code>. (But possibly
faster.)</TD>
<TD VAlign="top">&nbsp;-&nbsp;</TD>
</TR>
</table>
<h3>Complexity guarantees</h3>
All three functions are at most amortized linear time. For most practical
purposes, one can expect <code>boost::begin(a)</code>, <code>boost::end(a)</code> and <code>boost::empty(a)</code>
to be amortized constant time.
<code>boost::end(a)</code> is at most amortized linear time, <code>boost::begin(a)</code> is
amortized constant time. For most practical
purposes, one can expect both to be amortized constant time.
<h3>Invariants</h3>
<Table border>
@ -227,14 +214,17 @@ otherwise</TD>
<h3>See also</h3>
<p>
<A href="http://www.sgi.com/Technology/STL/Container.html">Container</A>
</p>
<p> <a href="boost_range.html#boost::range_value">implementation of
<p><a
href="boost_range.html#minimal_interface">Extending the library for UDTs </a></p>
<p> <a href="boost_range.html#boost::rang_difference">Implementation of
metafunctions </a></p>
<p> <a href="boost_range.html#begin">implementation of
<p> <a href="boost_range.html#begin">Implementation of
functions </a></p>
<p>
<A href="http://www.sgi.com/Technology/STL/Container.html">Container</A>
</p>
<hr>
<a name=forward_range><h2>Forward Range</h2>
@ -261,76 +251,8 @@ href="../../iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-
<h3>Refinement of</h3> <a href="#single_pass_range">Single Pass
Range</a>
<h3>Associated types</h3>
<table cellpadding="5" border="1">
<TR>
<TD VAlign="top">Distance type</TD>
<TD VAlign="top"><code>boost::range_difference&lt;X>::type</code></TD>
<TD VAlign="top">A signed integral type used to represent the distance between
two of the Range's iterators. This type must be the same as the iterator's
distance type.</TD>
</TR>
<TR>
<TD VAlign="top">Size type</TD>
<TD VAlign="top"><code>boost::range_size&lt;X>::type</code></TD>
<TD VAlign="top">An unsigned integral type that can represent any nonnegative
value of the Range's distance type.</TD>
</tr>
</table>
<h3>Valid expressions</h3>
<table border="1" cellpadding="5">
<tr>
<th>Name</th>
<th>Expression</th>
<th>Return type</th>
</tr>
<TR>
<TD VAlign="top">Size of range</TD>
<TD VAlign="top"><code>boost::size(a)</code></TD>
<TD VAlign="top"><code>boost::range_size&lt;X>::type</code></TD>
</TR>
</table>
<h3>Expression semantics </h3>
<table border="1" cellpadding="5">
<TR>
<TH>Expression</TH>
<TH>Semantics</TH>
<TH>Postcondition</TH>
</TR>
<tr>
<TD VAlign="top"><code>boost::size(a)</code></TD>
<TD VAlign="top">Returns the size of the Range, that is, its number
of elements. Note <code>boost::size(a) == 0u</code> is equivalent to
<code>boost::empty(a).</code></TD>
<TD VAlign="top"><code>boost::size(a) &gt;= 0</TD>
</TR>
</table>
<h3>Complexity guarantees</h3>
<p><code>boost::size(a)</code> is at most amortized linear time.</p>
<h3>Invariants</h3>
<p>
<Table border="1" cellpadding="5">
<TR>
<TD VAlign="top">Range size</TD>
<TD VAlign="top"><code>boost::size(a)</code> is equal to the distance from <code>boost::begin(a)</code>
to <code>boost::end(a)</code>.</TD> </table>
</p>
<h3>See also</h3>
<p> <a href="boost_range.html#boost::range_difference">implementation of
metafunctions </a></p>
<p> <a href="boost_range.html#size">implementation of
functions </a></p>
</p>
<hr>
<a name="bidirectional_range"><h2>Bidirectional Range</h2>
@ -356,83 +278,8 @@ s-lib-bidirectional-traversal-iterators">Bidirectional Traversal Iterator.</a>
<h3>Refinement of</h3> <a href="#forward_range">Forward Range</a>
<h3>Associated types</h3>
<Table border>
<TR>
<TD VAlign="top">Reverse Iterator type</TD>
<TD VAlign="top"><code>boost::range_reverse_iterator&lt;X>::type</code></TD>
<TD VAlign="top">The type of iterator used to iterate through a Range's elements
in reverse order. The iterator's value type is expected to be the Range's value
type. A conversion from the reverse iterator type to the const reverse iterator
type must exist. </TD>
</TR>
<TR>
<TD VAlign="top">Const reverse iterator type</TD>
<TD
VAlign="top"><code>boost::range_const_reverse_iterator&ltX>::type</code></TD>
<TD VAlign="top">A type of reverse iterator that may be used to examine, but not
to modify, a Range's elements.</TD>
</TR>
</table>
<h3>Valid expressions</h3>
<Table border>
<TR>
<TH>Name</TH>
<TH>Expression</TH>
<TH>Return type</TH>
<TH>Semantics</TH>
</TR>
<TR>
<TD VAlign="top">Beginning of range</TD>
<TD VAlign="top"><code>boost::rbegin(a)</code></TD>
<TD VAlign="top"><code>boost::range_reverse_iterator&lt;X>::type</code> if
<code>a</code> is mutable, <code>boost::range_const_reverse_iterator&lt;X>::type</code>
otherwise.</TD>
<TD VAlign="top">Equivalent to
<code>boost::range_reverse_iterator&lt;X>::type(boost::end(a))</code>.</TD> </TR>
<TR>
<TD VAlign="top">End of range</TD>
<TD VAlign="top"><code>boost::rend(a)</code></TD>
<TD VAlign="top"><code>boost::range_reverse_iterator&lt;X>::type</code> if
<code>a</code> is mutable, <code>boost::range_const_reverse_iterator&lt;X>::type</code>
otherwise.</TD>
<TD VAlign="top">Equivalent to
<code>boost::range_reverse_iterator&lt;X>::type(boost::begin(a))</code>.</TD> </tr>
</table>
<h3>Complexity guarantees</h3>
<code>boost::rbegin(a)</code> has the same complexity as <code>boost::end(a)</code> and <code>boost::rend(a)</code>
has the same complexity as <code>boost::begin(a)</code> from <a
href="#forward_range">Forward Range</a>.
<h3>Invariants</h3>
<p>
<Table border="1" cellpadding="5">
<TR>
<TD VAlign="top">Valid reverse range</TD>
<TD VAlign="top">For any Bidirectional Range <code>a</code>, <code>[boost::rbegin(a),boost::rend(a))</code>
is a valid range, that is, <code>boost::rend(a)</code> is reachable from <code>boost::rbegin(a)</code>
in a finite number of increments.</TD>
</TR>
<TR>
<TD VAlign="top">Completeness</TD>
<TD VAlign="top">An algorithm that iterates through the range <code>[boost::rbegin(a),boost::rend(a))</code>
will pass through every element of <code>a</code>.</TD>
</tr>
</table>
</p>
<h3>See also</h3>
<p> <a href="boost_range.html#boost::range_reverse_iterator">implementation of metafunctions </a></p>
<p> <a href="boost_range.html#rbegin">implementation of
functions </a></p>
</p>
<hr>
@ -455,7 +302,7 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator
<a name=concept_checking><h2>Concept Checking</h2>
Each of the range concepts has a corresponding concept checking
class in the file boost/range/concepts.hpp. These classes may be
class in the file <code><boost/range/concepts.hpp></codE>. These classes may be
used in conjunction with the <a
href="../../concept_check/concept_check.htm">Boost Concept
Check</a> library to insure that the type of a template parameter
@ -505,34 +352,16 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator
<p> <a href="../../concept_check/concept_check.htm">Boost Concept Check library</a></p>
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<!--
<h3>Notes</h3>
<P>
<A name="1">[1]</A>
The reference type does not have to be a real C++ reference. The requirements of
the reference type is that it <i>behaves</i> like a real reference. Hence the
reference type must be convertible to the value_type and assignment through
<br>
<br>
<HR>
<br>
-->
<TABLE>
<TR valign="top">
<TD nowrap>Copyright &copy 2000</TD>
<TD><A HREF=http://www.boost.org/people/jeremy_siek.htm>Jeremy Siek</A>
</TR>
<tr >
<TD nowrap>Copyright &copy 2004</TD>
<TD>Thorsten Ottosen.
</TABLE>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>
<br>

11
doc/style.css Executable file → Normal file
View File

@ -1,3 +1,14 @@
/*
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2008. Use, modification and
// distribution is subject to 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)
//
// For more information, see http://www.boost.org/libs/range/
//
*/
pre{
BORDER-RIGHT: gray 1pt solid;
PADDING-RIGHT: 2pt;

10
doc/style.html Executable file → Normal file
View File

@ -53,7 +53,7 @@
<a href="range.html#bidirectional_range">Bidirectional Range</a> <li>
<a href="range.html#random_access_range">Random Access Range</a> </ul>
</ul>
Notice how we have used the categories from the <a href=../../iterator/doc/new-iter-concepts.html>new
Notice how we have used the categories from the <a href="../../iterator/doc/new-iter-concepts.html">new
style iterators</a>.
<p>
@ -104,9 +104,15 @@
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2004
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>
<br>

View File

@ -27,17 +27,18 @@
<ul>
<li>
Class <a href=#iter_range><code>iterator_range</code></a>
Class <a href="#iter_range"><code>iterator_range</code></a>
<li>
Class <a href=#sub_range><code>sub_range</code></a>
Class <a href="#sub_range"><code>sub_range</code></a>
</ul>
</ul>
The <code>iterator_range</code> class is templated on an
<a href="../../iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators">Forward
The <code>iterator_range</code> class is templated on a <a
href="../../iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators">Forward
Traversal Iterator</a> and should be used whenever fairly general code is needed.
The <code>sub_range</code> class is templated on an <a href="range.html#forward_range">Forward
Range</a> and it is less general, but a bit easier to use since its template
The <code>sub_range</code> class is templated on a <a
href="range.html#forward_range">Forward Range</a> and it is less general,
but a bit easier to use since its template
argument is easier to specify. The biggest difference is, however, that a
<code>sub_range</code> can propagate constness because it knows what a
corresponding <code>const_iterator</code> is. </p>
@ -59,19 +60,16 @@ corresponding <code>const_iterator</code> is. </p>
<p>
If the template argument is not a model of Forward Traversal Iterator, one can
still use a subset of the interface. In particular, <code>size()</code> requires
Forward Traversal Iterators whereas <code>empty()</code> only requires Single
Random Access Iterators whereas <code>empty()</code> only requires Single
Pass Iterators.
</p>
<p>
Recall that many default constructed iterators
are <i>singular</i> and hence can only be assigned, but not compared or
incremented or anything. However, if one creates a default constructed
<code>iterator_range</code>, then one
can still call all its member functions. This means that the
<code>iterator_range</code> will still be usable in many contexts even
though the iterators underneath are not.
</p>
incremented or anything. Likewise, if one creates a default constructed
<code>iterator_range</code>, then one have to be careful about not doing
anything besides copying. </p>
<h3>Synopsis</h3>
@ -82,12 +80,10 @@ corresponding <code>const_iterator</code> is. </p>
</span><span class=keyword>class </span><span class=identifier>iterator_range
</span><span class=special>{
</span><span class=keyword>public</span><span class=special>: </span><span class=comment>// Forward Range types
</span><span class=keyword>typedef </span><span class=special>... </span><span class=identifier>value_type</span><span class=special>;
</span><span class=keyword>typedef </span><span class=special>... </span><span class=identifier>difference_type</span><span class=special>;
</span><span class=keyword>typedef </span><span class=special>... </span><span class=identifier>size_type</span><span class=special>;
</span><span class=keyword>typedef </span><span class=identifier>ForwardTraversalIterator </span><span class=identifier>iterator</span><span class=special>;
</span><span class=keyword>typedef </span><span class=identifier>ForwardTraversalIterator </span><span class=identifier>const_iterator</span><span class=special>;
</span><span class=keyword>typedef </span><span class=identifier>ForwardTraversalIterator </span><span class=identifier>iterator</span><span class=special>;
</span><span class=keyword>typedef </span><span class=identifier>ForwardTraversalIterator </span><span class=identifier>const_iterator</span><span class=special>;</span>
<span class=keyword>typedef </span><span class=identifier>iterator_difference</span><span class=special>&lt;</span><span class=identifier>iterator</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>difference_type</span><span class=special>;</span>
</span><span class=keyword>public</span><span class=special>: </span><span class=comment>// construction, assignment
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>ForwardTraversalIterator2 </span><span class=special>&gt;
</span><span class=identifier>iterator_range</span><span class=special>( </span><span class=identifier>ForwardTraversalIterator2 </span><span class=identifier>Begin</span><span class=special>, </span><span class=identifier>ForwardTraversalIterator2 </span><span class=identifier>End </span><span class=special>);
@ -105,22 +101,24 @@ corresponding <code>const_iterator</code> is. </p>
</span><span class=identifier>iterator_range</span><span class=special>&amp; </span><span class=keyword>operator</span><span class=special>=( </span><span class=keyword>const </span><span class=identifier>ForwardRange</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>public</span><span class=special>: </span><span class=comment>// Forward Range functions
</span><span class=identifier>iterator </span><span class=identifier>begin</span><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span><span class=identifier>iterator </span><span class=identifier>end</span><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span><span class=identifier>size_type </span><span class=identifier>size</span><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span><span class=keyword>bool </span><span class=identifier>empty</span><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span><span class=identifier>iterator </span><span class=identifier>begin</span><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span><span class=identifier>iterator </span><span class=identifier>end</span><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span><span class=identifier>difference_type </span><span class=identifier>size</span><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span><span class=keyword>bool </span><span class=identifier>empty</span><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span><span class=keyword>public</span><span class=special>: </span><span class=comment>// convenience
</span><span class=keyword>operator </span><a href="#unspecified_bool"><span class=identifier>unspecified_bool_type</span></a><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span> <span class=keyword>bool</span> <span
</span><span class=keyword>operator </span><a href="#unspecified_bool"><span class=identifier>unspecified_bool_type</span></a><span class=special>() </span><span class=keyword>const</span><span class=special>;
</span> <span class=keyword>bool</span> <span
class=identifier><a href="#equal">equal</a></span><span
class=special>( </span><span class=keyword>const <span
class=identifier>iterator_range</span><span class=special>& ) </span><span
class=special>( </span><span class=keyword>const</span> <span class=identifier>iterator_range</span><span class=special>& ) </span><span
class=keyword>const;</span>
<span class=identifier>value_type</span><span class=special>&amp; </span><span class=identifier>front</span><span class=special>() </span><span class=keyword>const</span><span class=special>;</span>
<span class=identifier>value_type</span><span class=special>&amp; </span><span class=identifier>back</span><span class=special>() </span><span class=keyword>const</span><span class=special>;</span>
<span class=identifier>reference </span><span class=identifier>front</span><span class=special>() </span><span class=keyword>const</span><span class=special>;</span>
<span class=identifier>reference </span><span class=identifier>back</span><span class=special>() </span><span class=keyword>const</span><span class=special>;</span>
<span class=identifier>iterator_range</span><span class=special>&amp;</span> <span class=identifier>advance_begin</span><span class=special>(</span> <span class=identifier>difference_type</span> <span class=identifier>n</span> <span class=special>);</span>
<span class=identifier>iterator_range</span><span class=special>&amp;</span> <span class=identifier>advance_end</span><span class=special>(</span> <span class=identifier>difference_type</span> <span class=identifier>n</span> <span class=special>);</span>
<span class=comment>// for Random Access Range only: </span>
<span class=identifier>value_type</span><span class=special>&amp; </span><span class=keyword>operator</span><span class=special>[]( </span><span class=identifier>size_type </span><span class=identifier>at </span><span class=special>) </span><span class=keyword>const</span><span class=special>;</span>
<span class=identifier>reference </span><span class=keyword>operator</span><span class=special>[]( </span><span class=identifier>difference_type </span><span class=identifier>at </span><span class=special>) </span><span class=keyword>const</span><span class=special>;</span>
<span class=identifier>value_type</span> <span class=keyword>operator</span><span class=special>()( </span><span class=identifier>difference_type </span><span class=identifier>at </span><span class=special>) </span><span class=keyword>const</span><span class=special>;</span>
</span><span class=special>};
</span><span class=comment>// stream output
@ -173,11 +171,11 @@ class=keyword>const;</span>
</span><span class=identifier>ForwardTraversalIterator </span><span class=identifier>End </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>ForwardRange </span><span class=special>&gt;
</span><span class=identifier>iterator_range</span><span class=special>&lt; </span><span class=keyword>typename </span><span class=identifier>iterator</span><span class=special>&lt;</span><span class=identifier>ForwardRange</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=special>&gt;
</span><span class=identifier>iterator_range</span><span class=special>&lt; </span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>ForwardRange</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=special>&gt;
</span><span class=identifier>make_iterator_range</span><span class=special>( </span><span class=identifier>ForwardRange</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>ForwardRange </span><span class=special>&gt;
</span><span class=identifier>iterator_range</span><span class=special>&lt; </span><span class=keyword>typename </span><span class=identifier>const_iterator</span><span class=special>&lt;</span><span class=identifier>ForwardRange</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=special>&gt;
</span><span class=identifier>iterator_range</span><span class=special>&lt; </span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>ForwardRange</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=special>&gt;
</span><span class=identifier>make_iterator_range</span><span class=special>( </span><span class=keyword>const </span><span class=identifier>ForwardRange</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span>
<span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>Range </span><span class=special>&gt;</span>
@ -187,7 +185,7 @@ class=keyword>const;</span>
</span><span class=keyword>typename </span><span class=identifier>range_difference</span><span class=special>&lt;</span><span class=identifier>Range</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>advance_end </span><span class=special>);
</span>
<span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>Range </span><span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt; </span><span class=keyword>typename </span><span class=identifier>range_const_iterator</span><span class=special>&lt;</span><span class=identifier>Range</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt; </span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>Range</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=special>&gt;</span>
<span class=identifier>make_iterator_range</span><span class=special>( </span><span class=keyword>const </span><span class=identifier>Range</span><span class=special>&amp; </span><span class=identifier>r</span><span class=special>,
</span><span class=keyword>typename </span><span class=identifier>range_difference</span><span class=special>&lt;</span><span class=identifier>Range</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>advance_begin</span><span class=special>,
</span><span class=keyword>typename </span><span class=identifier>range_difference</span><span class=special>&lt;</span><span class=identifier>Range</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>advance_end </span><span class=special>);</span>
@ -291,12 +289,14 @@ class can propagate constness since it knows what a corresponding
<span class=keyword>namespace </span><span class=identifier>boost</span>
<span class=special>{
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>ForwardRange </span><span class=special>&gt;
</span><span class=keyword>class </span><span class=identifier>sub_range </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>iterator_range</span><span class=special>&lt; </span><span class=keyword>typename </span><span class=identifier>range_result_iterator</span><span class=special>&lt;</span><span class=identifier>ForwardRange</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=special>&gt;
</span><span class=keyword>class </span><span class=identifier>sub_range </span><span class=special>: </span><span class=keyword>public </span><span class=identifier>iterator_range</span><span class=special>&lt; </span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>ForwardRange</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=special>&gt;
</span><span class=special>{
</span><span class=keyword>public</span><span class=special>: </span>
<span class=keyword>typedef </span><span class=keyword>typename </span><span class=identifier>range_result_iterator</span><span class=special>&lt;</span><span class=identifier>ForwardRange</span><spanclass=special>&gt;::</span><span class=identifier>type </span><span class=identifier>iterator</span><span class=special>;</span>
<span class=keyword>typedef </span><span class=keyword>typename </span><span class=identifier>range_const_iterator</span><span class=special>&lt;</span><span class=identifier>ForwardRange</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>const_iterator</span><span class=special>;</span>
<span class=keyword>typedef </span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>ForwardRange</span><spanclass=special>&gt;::</span><span class=identifier>type </span><span class=identifier>iterator</span><span class=special>;</span>
<span class=keyword>typedef </span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>ForwardRange</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>const_iterator</span><span class=special>;</span>
<span class=keyword>typedef </span><span class=keyword>typename </span><span class=identifier>iterator_difference</span><span class=special>&lt;</span><span class=identifier>iterator</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>difference_type</span><span class=special>;</span>
<span class=keyword>public</span><span class=special>: </span><span class=comment>// construction, assignment
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>ForwardTraversalIterator </span><span class=special>&gt;
</span><span class=identifier>sub_range</span><span class=special>( </span><span class=identifier>ForwardTraversalIterator </span><span class=identifier>Begin</span><span class=special>, </span><span class=identifier>ForwardTraversalIterator </span><span class=identifier>End </span><span class=special>);
@ -325,11 +325,11 @@ class can propagate constness since it knows what a corresponding
<span class=identifier>value_type</span><span class=special>&amp; </span><span class=identifier>back</span><span class=special>();</span>
<span class=keyword>const </span><span class=identifier>value_type</span><span class=special>&amp; </span><span class=identifier>back</span><span class=special>() </span><span class=keyword>const</span><span class=special>;</span>
<span class=comment>// for Random Access Range only: </span>
<span class=identifier>value_type</span><span class=special>&amp; </span><span class=keyword>operator</span><span class=special>[]( </span><span class=identifier>size_type </span><span class=identifier>at </span><span class=special>);</span>
<span class=keyword>const </span><span class=identifier>value_type</span><span class=special>&amp; </span><span class=keyword>operator</span><span class=special>[]( </span><span class=identifier>size_type </span><span class=identifier>at </span><span class=special>) </span><span class=keyword>const</span><span class=special>;</span>
<span class=identifier>value_type</span><span class=special>&amp; </span><span class=keyword>operator</span><span class=special>[]( </span><span class=identifier>difference_type </span><span class=identifier>at </span><span class=special>);</span>
<span class=keyword>const </span><span class=identifier>value_type</span><span class=special>&amp; </span><span class=keyword>operator</span><span class=special>[]( </span><span class=identifier>difference_type </span><span class=identifier>at </span><span class=special>) </span><span class=keyword>const</span><span class=special>;</span>
<span class=keyword>public</span><span class=special>:
</span><span class=comment>// rest of interface inherited from <a href=#iter_range><code>iterator_range</code></a>
</span><span class=comment>// rest of interface inherited from <a href="#iter_range"><code>iterator_range</code></a>
</span><span class=special>};
</span>
<span class=special>} </span><span class=comment>// namespace 'boost'</span>
@ -344,16 +344,23 @@ store the result
from this algorithm. Here is an example of how we can do it with and without
<code>sub_range</code>
<pre>
<span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=identifier>str</span><span class=special>(</span><span class=string>&quot;hello&quot;</span><span class=special>);
</span><span class=identifier>iterator_range</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>::</span><span class=identifier>iterator</span><span class=special>&gt; </span><span class=identifier>ir </span><span class=special>= </span><span class=identifier>find_first</span><span class=special>( </span><span class=identifier>str</span><span class=special>, </span><span class=string>&quot;ll&quot; </span><span class=special>);
</span><span class=identifier>sub_range</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>&gt; </span><span class=identifier>sub </span><span class=special>= </span><span class=identifier>find_first</span><span class=special>( </span><span class=identifier>str</span><span class=special>, </span><span class=string>&quot;ll&quot; </span><span class=special>);</span>
<span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span> <span class=identifier>str</span><span class=special>(</span><span class=string>&quot;hello&quot;</span><span class=special>);</span>
<span class=identifier>iterator_range</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>::</span><span class=identifier>iterator</span><span class=special>&gt;</span> <span class=identifier>ir</span> <span class=special>=</span> <span class=identifier>find_first</span><span class=special>(</span> <span class=identifier>str</span><span class=special>,</span> <span class=identifier>as_literal</span><span class=special>(</span><span class=string>&quot;ll&quot;</span><span class=special>)</span> <span class=special>);</span>
<span class=identifier>sub_range</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>&gt;</span> <span class=identifier>sub</span> <span class=special>=</span> <span class=identifier>find_first</span><span class=special>(</span> <span class=identifier>str</span><span class=special>,</span> <span class=identifier>as_literal</span><span class=special>(</span><span class=string>&quot;ll&quot;</span><span class=special>)</span> <span class=special>);</span>
</pre>
</p>
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2004
</p>
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>

0
include/boost/range.hpp Executable file → Normal file
View File

0
include/boost/range/as_array.hpp Executable file → Normal file
View File

30
include/boost/range/as_literal.hpp Executable file → Normal file
View File

@ -8,14 +8,14 @@
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_DETAIL_AS_LITERAL_HPP
#define BOOST_RANGE_DETAIL_AS_LITERAL_HPP
#ifndef BOOST_RANGE_AS_LITERAL_HPP
#define BOOST_RANGE_AS_LITERAL_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif
#if BOOST_NO_FUNCTION_TEMPLATE_ORDERING
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
#include <boost/range/detail/as_literal.hpp>
#else
@ -25,7 +25,9 @@
#include <boost/detail/workaround.hpp>
#include <cstring>
#ifndef BOOST_NO_CWCHAR
#include <cwchar>
#endif
namespace boost
{
@ -36,10 +38,12 @@ namespace boost
return strlen( s );
}
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
inline std::size_t length( const wchar_t* s )
{
return wcslen( s );
}
#endif
//
// Remark: the compiler cannot choose between T* and T[sz]
@ -57,7 +61,7 @@ namespace boost
return true;
}
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
inline bool is_char_ptr( wchar_t* )
{
return true;
@ -67,6 +71,7 @@ namespace boost
{
return true;
}
#endif
template< class T >
inline long is_char_ptr( T /* r */ )
@ -107,23 +112,14 @@ namespace boost
template< class Char, std::size_t sz >
inline iterator_range<Char*> as_literal( Char (&arr)[sz] )
{
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) && __BORLANDC__ >= 0x590
return boost::make_iterator_range<Char*>( arr, arr + sz - 1 );
#else
return boost::make_iterator_range( arr, arr + sz - 1 );
#endif
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
}
template< class Char, std::size_t sz >
inline iterator_range<const Char*> as_literal( const Char (&arr)[sz] )
inline iterator_range<const Char*> as_literal( const Char (&arr)[sz] )
{
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x590)) && __BORLANDC__ >= 0x590
return boost::make_iterator_range<const Char*>( arr, arr + sz - 1 );
#else
return boost::make_iterator_range( arr, arr + sz - 1 );
#endif
}
return range_detail::make_range( arr, range_detail::is_char_ptr(arr) );
}
}
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING

13
include/boost/range/begin.hpp Executable file → Normal file
View File

@ -41,6 +41,11 @@ namespace range_detail
inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
range_begin( C& c )
{
//
// If you get a compile-error here, it is most likely because
// you have not implemented range_begin() properly in
// the namespace of C
//
return c.begin();
}
@ -68,15 +73,15 @@ namespace range_detail
// May this be discarded? Or is it needed for bad compilers?
//
template< typename T, std::size_t sz >
inline const T* range_begin( const T (&array)[sz] )
inline const T* range_begin( const T (&a)[sz] )
{
return array;
return a;
}
template< typename T, std::size_t sz >
inline T* range_begin( T (&array)[sz] )
inline T* range_begin( T (&a)[sz] )
{
return array;
return a;
}

0
include/boost/range/category.hpp Executable file → Normal file
View File

48
include/boost/range/concepts.hpp Executable file → Normal file
View File

@ -13,8 +13,8 @@
#include <boost/concept_check.hpp>
#include <boost/iterator/iterator_concepts.hpp>
#include <boost/range/functions.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
/*!
* \file
@ -57,10 +57,10 @@ namespace boost {
//! Check if a type T models the SinglePassRange range concept.
template<typename T>
struct SinglePassRangeConcept {
typedef typename range_value<T>::type range_value;
typedef typename range_iterator<T>::type range_iterator;
//typedef typename range_iterator<const T>::type range_const_iterator;
struct SinglePassRangeConcept
{
typedef typename range_iterator<T const>::type range_const_iterator;
typedef typename range_iterator<T>::type range_iterator;
void constraints()
{
@ -71,23 +71,23 @@ namespace boost {
>();
i = boost::begin(a);
i = boost::end(a);
b = boost::empty(a);
const_constraints(a);
}
void const_constraints(const T& a)
{
//ci = boost::begin(a);
//ci = boost::end(a);
ci = boost::begin(a);
ci = boost::end(a);
}
T a;
range_iterator i;
bool b;
range_const_iterator ci;
};
//! Check if a type T models the ForwardRange range concept.
template<typename T>
struct ForwardRangeConcept {
typedef typename range_difference<T>::type range_difference;
struct ForwardRangeConcept
{
void constraints()
{
function_requires<
@ -103,8 +103,8 @@ namespace boost {
//! Check if a type T models the BidirectionalRange range concept.
template<typename T>
struct BidirectionalRangeConcept {
typedef typename range_reverse_iterator<T>::type range_reverse_iterator;
struct BidirectionalRangeConcept
{
void constraints()
{
function_requires<
@ -115,24 +115,13 @@ namespace boost {
typename range_iterator<T>::type
>
>();
i = boost::rbegin(a);
i = boost::rend(a);
const_constraints(a);
}
void const_constraints(const T& a)
{
//ci = boost::rbegin(a);
//ci = boost::rend(a);
}
T a;
range_reverse_iterator i;
};
//! Check if a type T models the RandomAccessRange range concept.
template<typename T>
struct RandomAccessRangeConcept {
typedef typename range_size<T>::type range_size;
struct RandomAccessRangeConcept
{
void constraints()
{
function_requires<
@ -143,12 +132,7 @@ namespace boost {
typename range_iterator<T>::type
>
>();
s = boost::size(a);
}
T a;
range_size s;
};
} // namespace boost

3
include/boost/range/config.hpp Executable file → Normal file
View File

@ -37,8 +37,7 @@
#error "macro already defined!"
#endif
//#if BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) || __MWERKS__ <= 0x3003
#if _MSC_VER <= 1300 && !defined( __COMO__ ) && !defined( __GNUC__ ) && __MWERKS__ <= 0x3003
#if BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) || BOOST_WORKAROUND( __MWERKS__, <= 0x3003 )
#define BOOST_RANGE_NO_ARRAY_SUPPORT 1
#endif

0
include/boost/range/const_iterator.hpp Executable file → Normal file
View File

0
include/boost/range/const_reverse_iterator.hpp Executable file → Normal file
View File

4
include/boost/range/detail/as_literal.hpp Executable file → Normal file
View File

@ -8,8 +8,8 @@
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_AS_LITERAL_HPP
#define BOOST_RANGE_AS_LITERAL_HPP
#ifndef BOOST_RANGE_DETAIL_AS_LITERAL_HPP
#define BOOST_RANGE_DETAIL_AS_LITERAL_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once

0
include/boost/range/detail/begin.hpp Executable file → Normal file
View File

0
include/boost/range/detail/collection_traits.hpp Executable file → Normal file
View File

View File

0
include/boost/range/detail/common.hpp Executable file → Normal file
View File

0
include/boost/range/detail/const_iterator.hpp Executable file → Normal file
View File

0
include/boost/range/detail/detail_str.hpp Executable file → Normal file
View File

0
include/boost/range/detail/difference_type.hpp Executable file → Normal file
View File

0
include/boost/range/detail/empty.hpp Executable file → Normal file
View File

0
include/boost/range/detail/end.hpp Executable file → Normal file
View File

4
include/boost/range/detail/implementation_help.hpp Executable file → Normal file
View File

@ -25,6 +25,8 @@ namespace boost
{
namespace range_detail
{
template <typename T>
inline void boost_range_silence_warning( const T& ) { }
/////////////////////////////////////////////////////////////////////
// end() help
@ -82,12 +84,14 @@ namespace boost
template< class T, std::size_t sz >
inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] )
{
boost_range_silence_warning( boost_range_array );
return sz;
}
template< class T, std::size_t sz >
inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] )
{
boost_range_silence_warning( boost_range_array );
return sz;
}

0
include/boost/range/detail/iterator.hpp Executable file → Normal file
View File

View File

@ -1,9 +1,6 @@
#ifndef BOOST_RANGE_DETAIL_MICROSOFT_HPP
#define BOOST_RANGE_DETAIL_MICROSOFT_HPP
// Boost.Range MFC/ATL Extension
//
// Copyright Shunsuke Sogame 2005-2006.
@ -931,5 +928,4 @@ namespace boost { namespace range_detail_microsoft {
#endif

0
include/boost/range/detail/remove_extent.hpp Executable file → Normal file
View File

0
include/boost/range/detail/sfinae.hpp Executable file → Normal file
View File

0
include/boost/range/detail/size.hpp Executable file → Normal file
View File

0
include/boost/range/detail/size_type.hpp Executable file → Normal file
View File

6
include/boost/range/detail/sizer.hpp Executable file → Normal file
View File

@ -25,12 +25,10 @@ namespace boost
//////////////////////////////////////////////////////////////////////
template< typename T, std::size_t sz >
char&
sizer( const T BOOST_RANGE_ARRAY_REF()[sz] )[sz];
char (& sizer( const T BOOST_RANGE_ARRAY_REF()[sz] ) )[sz];
template< typename T, std::size_t sz >
char&
sizer( T BOOST_RANGE_ARRAY_REF()[sz] )[sz];
char (& sizer( T BOOST_RANGE_ARRAY_REF()[sz] ) )[sz];
} // namespace 'boost'

0
include/boost/range/detail/str_types.hpp Executable file → Normal file
View File

0
include/boost/range/detail/value_type.hpp Executable file → Normal file
View File

0
include/boost/range/detail/vc6/end.hpp Executable file → Normal file
View File

0
include/boost/range/detail/vc6/size.hpp Executable file → Normal file
View File

0
include/boost/range/difference_type.hpp Executable file → Normal file
View File

0
include/boost/range/distance.hpp Executable file → Normal file
View File

0
include/boost/range/empty.hpp Executable file → Normal file
View File

13
include/boost/range/end.hpp Executable file → Normal file
View File

@ -42,6 +42,11 @@ namespace range_detail
inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
range_end( C& c )
{
//
// If you get a compile-error here, it is most likely because
// you have not implemented range_begin() properly in
// the namespace of C
//
return c.end();
}
@ -66,15 +71,15 @@ namespace range_detail
//////////////////////////////////////////////////////////////////////
template< typename T, std::size_t sz >
inline const T* range_end( const T (&array)[sz] )
inline const T* range_end( const T (&a)[sz] )
{
return range_detail::array_end<T,sz>( array );
return range_detail::array_end<T,sz>( a );
}
template< typename T, std::size_t sz >
inline T* range_end( T (&array)[sz] )
inline T* range_end( T (&a)[sz] )
{
return range_detail::array_end<T,sz>( array );
return range_detail::array_end<T,sz>( a );
}
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \

0
include/boost/range/functions.hpp Executable file → Normal file
View File

0
include/boost/range/iterator.hpp Executable file → Normal file
View File

95
include/boost/range/iterator_range.hpp Executable file → Normal file
View File

@ -11,8 +11,15 @@
#ifndef BOOST_RANGE_ITERATOR_RANGE_HPP
#define BOOST_RANGE_ITERATOR_RANGE_HPP
// From boost/dynamic_bitset.hpp; thanks to Matthias Troyer for Cray X1 patch.
#include <boost/config.hpp> // Define __STL_CONFIG_H, if appropriate.
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
#pragma warning( push )
#pragma warning( disable : 4996 )
#endif
// From boost/dynamic_bitset.hpp; thanks to Matthias Troyer for Cray X1 patch.
#ifndef BOOST_OLD_IOSTREAMS
# if defined(__STL_CONFIG_H) && \
!defined (__STL_USE_NEW_IOSTREAMS) && !defined(__crayx1) \
@ -21,25 +28,24 @@
# endif
#endif // #ifndef BOOST_OLD_IOSTREAMS
#include <boost/detail/workaround.hpp>
#include <boost/assert.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/type_traits/is_abstract.hpp>
#include <boost/range/functions.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/difference_type.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/assert.hpp>
#include <boost/utility/enable_if.hpp>
#include <iterator>
#include <algorithm>
#ifndef BOOST_OLD_IOSTREAMS
# include <ostream>
#else
# include <ostream.h>
#endif
#ifndef _STLP_NO_IOSTREAMS
# ifndef BOOST_OLD_IOSTREAMS
# include <ostream>
# else
# include <ostream.h>
# endif
#endif // _STLP_NO_IOSTREAMS
#include <cstddef>
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400)
#pragma warning( disable : 4996 )
#endif
/*! \file
Defines the \c iterator_class and related functions.
\c iterator_range is a simple wrapper of iterator pair idiom. It provides
@ -73,10 +79,10 @@ namespace boost
template< class Left, class Right >
inline bool equal( const Left& l, const Right& r )
{
typedef BOOST_DEDUCED_TYPENAME boost::range_size<Left>::type sz_type;
typedef BOOST_DEDUCED_TYPENAME boost::range_difference<Left>::type sz_type;
sz_type l_size = boost::size( l ),
r_size = boost::size( r );
sz_type l_size = boost::distance( l ),
r_size = boost::distance( r );
if( l_size != r_size )
return false;
@ -161,32 +167,25 @@ namespace boost
//! iterator type
typedef IteratorT iterator;
private: // for return value of operator()()
typedef BOOST_DEDUCED_TYPENAME
boost::mpl::if_< boost::is_abstract<value_type>,
reference, value_type >::type abstract_value_type;
public:
iterator_range() : m_Begin( iterator() ), m_End( iterator() )
#ifndef NDEBUG
, singular( true )
#endif
{ }
/*
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
iterator_range( this_type r ) :
: m_Begin(r.begin()), m_End(r.end())
{ }
this_type& operator=( this_type r )
{
m_Begin = r.begin();
m_End = r.end();
return *this;
}
#endif
*/
//! Constructor from a pair of iterators
template< class Iterator >
iterator_range( Iterator Begin, Iterator End ) :
m_Begin(Begin), m_End(End)
#ifndef NDEBUG
, singular(false)
#endif
#endif
{}
//! Constructor from a Range
@ -211,7 +210,7 @@ namespace boost
template< class Range >
iterator_range( const Range& r, iterator_range_detail::const_range_tag ) :
m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) )
#ifndef NDEBUG
#ifndef NDEBUG
, singular(false)
#endif
{}
@ -220,7 +219,7 @@ namespace boost
template< class Range >
iterator_range( Range& r, iterator_range_detail::range_tag ) :
m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) )
#ifndef NDEBUG
#ifndef NDEBUG
, singular(false)
#endif
{}
@ -283,7 +282,7 @@ namespace boost
return m_End;
}
size_type size() const
difference_type size() const
{
BOOST_ASSERT( !is_singular() );
return m_End - m_Begin;
@ -351,9 +350,9 @@ namespace boost
return *--last;
}
reference operator[]( size_type at ) const
reference operator[]( difference_type at ) const
{
BOOST_ASSERT( at < size() );
BOOST_ASSERT( at >= 0 && at < size() );
return m_Begin[at];
}
@ -361,10 +360,10 @@ namespace boost
// When storing transform iterators, operator[]()
// fails because it returns by reference. Therefore
// operator()() is provided for these cases.
//
value_type operator()( size_type at ) const
//
abstract_value_type operator()( difference_type at ) const
{
BOOST_ASSERT( at < size() );
BOOST_ASSERT( at >= 0 && at < size() );
return m_Begin[at];
}
@ -391,13 +390,15 @@ namespace boost
bool singular;
#endif
#ifndef NDEBUG
public:
bool is_singular() const
{
#ifndef NDEBUG
return singular;
#else
return false;
#endif
}
#endif
protected:
//
@ -409,7 +410,8 @@ namespace boost
// iterator range free-standing operators ---------------------------//
#ifndef BOOST_OLD_IOSTREAMS
#ifndef _STLP_NO_IOSTREAMS
# ifndef BOOST_OLD_IOSTREAMS
//! iterator_range output operator
/*!
@ -428,7 +430,7 @@ namespace boost
return Os;
}
#else
# else
//! iterator_range output operator
/*!
@ -444,7 +446,8 @@ namespace boost
return Os;
}
#endif
# endif
#endif // _STLP_NO_IOSTREAMS
/////////////////////////////////////////////////////////////////////
// comparison operators
@ -648,5 +651,9 @@ namespace boost
#undef BOOST_OLD_IOSTREAMS
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
#pragma warning( pop )
#endif
#endif

0
include/boost/range/metafunctions.hpp Executable file → Normal file
View File

0
include/boost/range/mutable_iterator.hpp Executable file → Normal file
View File

0
include/boost/range/pointer.hpp Executable file → Normal file
View File

0
include/boost/range/rbegin.hpp Executable file → Normal file
View File

0
include/boost/range/reference.hpp Executable file → Normal file
View File

0
include/boost/range/rend.hpp Executable file → Normal file
View File

0
include/boost/range/result_iterator.hpp Executable file → Normal file
View File

0
include/boost/range/reverse_iterator.hpp Executable file → Normal file
View File

0
include/boost/range/reverse_result_iterator.hpp Executable file → Normal file
View File

7
include/boost/range/size.hpp Executable file → Normal file
View File

@ -17,14 +17,17 @@
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/size_type.hpp>
#include <boost/range/difference_type.hpp>
#include <boost/assert.hpp>
namespace boost
{
template< class T >
inline BOOST_DEDUCED_TYPENAME range_size<T>::type size( const T& r )
inline BOOST_DEDUCED_TYPENAME range_difference<T>::type size( const T& r )
{
BOOST_ASSERT( (boost::end( r ) - boost::begin( r )) >= 0 &&
"reachability invariant broken!" );
return boost::end( r ) - boost::begin( r );
}

0
include/boost/range/size_type.hpp Executable file → Normal file
View File

33
include/boost/range/sub_range.hpp Executable file → Normal file
View File

@ -11,16 +11,20 @@
#ifndef BOOST_RANGE_SUB_RANGE_HPP
#define BOOST_RANGE_SUB_RANGE_HPP
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400)
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
#pragma warning( push )
#pragma warning( disable : 4996 )
#endif
#include <boost/detail/workaround.hpp>
#include <boost/range/config.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/value_type.hpp>
#include <boost/range/size_type.hpp>
#include <boost/range/difference_type.hpp>
#include <boost/assert.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost
{
@ -38,12 +42,19 @@ namespace boost
typedef BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type const_iterator;
typedef BOOST_DEDUCED_TYPENAME range_difference<ForwardRange>::type difference_type;
typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type;
typedef BOOST_DEDUCED_TYPENAME base::reference reference;
public: // for return value of front/back
typedef BOOST_DEDUCED_TYPENAME
boost::mpl::if_< boost::is_reference<reference>,
const BOOST_DEDUCED_TYPENAME boost::remove_reference<reference>::type&,
reference >::type const_reference;
public:
sub_range() : base()
{ }
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || BOOST_WORKAROUND(BOOST_MSVC, == 1400)
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500) )
sub_range( const sub_range& r )
: base( static_cast<const base&>( r ) )
{ }
@ -100,36 +111,36 @@ namespace boost
const_iterator begin() const { return base::begin(); }
iterator end() { return base::end(); }
const_iterator end() const { return base::end(); }
size_type size() const { return base::size(); }
difference_type size() const { return base::size(); }
public: // convenience
value_type& front()
reference front()
{
return base::front();
}
const value_type& front() const
const_reference front() const
{
return base::front();
}
value_type& back()
reference back()
{
return base::back();
}
const value_type& back() const
const_reference back() const
{
return base::back();
}
value_type& operator[]( size_type sz )
reference operator[]( difference_type sz )
{
return base::operator[](sz);
}
const value_type& operator[]( size_type sz ) const
const_reference operator[]( difference_type sz ) const
{
return base::operator[](sz);
}
@ -160,5 +171,9 @@ namespace boost
} // namespace 'boost'
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
#pragma warning( pop )
#endif
#endif

0
include/boost/range/value_type.hpp Executable file → Normal file
View File

12
index.html Executable file → Normal file
View File

@ -18,11 +18,11 @@
</table>
<p>
Copyright <20> 2003-2004 Thorsten Ottosen
Copyright <20> 2003-2007 Thorsten Ottosen
</p>
<p>
Use, modification and distribution is subject to the Boost Software License, Version 1.0
(see <a href=http://www.boost.org/LICENSE_1_0.txt>
(see <a href="http://www.boost.org/LICENSE_1_0.txt">
http://www.boost.org/LICENSE_1_0.txt</a>).
</p>
@ -52,18 +52,14 @@
<li> <a href="doc/style.html">Terminology and style guidelines </a>
<li><a href="doc/headers.html">Headers</a> </li>
<li><a href="doc/examples.html">Examples</a>
<li><a href="doc/mfc_atl.html">MFC/ATL mapping (courtesy of Shunsuke
Sogame)</a></li>
<li><a href="doc/mfc_atl.html">MFC/ATL mapping (courtesy of Shunsuke
Sogame)</a></li>
<li><a href="doc/portability.html">Portability</a>
<li><a href="doc/faq.html">FAQ</a>
<li><a href="doc/history_ack.html">History and acknowledgment</a>
</ul>
<hr>
<p>
(C) Copyright Thorsten Ottosen 2003-2004
</p>
<br>
<br>

View File

@ -12,9 +12,9 @@ rule range-test ( name : includes * )
{
return [
run $(name).cpp /boost/test//boost_unit_test_framework/<link>static
:
:
:
: $(includes)
: <toolset>gcc:<cxxflags>"-Wall -Wunused "
] ;
}

View File

@ -1 +0,0 @@

0
test/adl_conformance.cpp Executable file → Normal file
View File

0
test/adl_conformance_no_using.cpp Executable file → Normal file
View File

4
test/algorithm_example.cpp Executable file → Normal file
View File

@ -64,14 +64,14 @@ void check_algorithm()
//
// usage
//
const unsigned N = 5;
const int N = 5;
std::vector<int> my_vector;
int values[] = { 1,2,3,4,5,6,7,8,9 };
my_vector.assign( values, values + 9 );
typedef std::vector<int>::iterator iterator;
std::pair<iterator,iterator> my_view( boost::begin( my_vector ),
boost::begin( my_vector ) + N );
BOOST_CHECK_EQUAL( my_generic_replace( my_vector, 4, 2 ), 3u );
BOOST_CHECK_EQUAL( my_generic_replace( my_vector, 4, 2 ), 3 );
BOOST_CHECK_EQUAL( my_generic_replace( my_view, 4, 2 ), N );
}

2
test/array.cpp Executable file → Normal file
View File

@ -63,7 +63,7 @@ void check_array()
BOOST_CHECK_EQUAL( empty( ca ),false );
const char A[] = "\0A";
BOOST_CHECK_EQUAL( boost::size(A), 3u );
BOOST_CHECK_EQUAL( boost::size(A), 3 );
}
using boost::unit_test::test_suite;

View File

0
test/compat2.cpp Executable file → Normal file
View File

0
test/compat3.cpp Executable file → Normal file
View File

0
test/const_ranges.cpp Executable file → Normal file
View File

1
test/extension_mechanism.cpp Executable file → Normal file
View File

@ -44,7 +44,6 @@ namespace Foo
typedef std::vector<int> data_t;
typedef data_t::iterator iterator;
typedef data_t::const_iterator const_iterator;
typedef data_t::size_type size_type;
data_t vec;

6
test/iterator_pair.cpp Executable file → Normal file
View File

@ -65,17 +65,17 @@ void check_iterator_pair()
BOOST_CHECK( begin( pair ) == pair.first );
BOOST_CHECK( end( pair ) == pair.second );
BOOST_CHECK( empty( pair ) == (pair.first == pair.second) );
BOOST_CHECK( size( pair ) == std::size_t( std::distance( pair.first, pair.second ) ) );
BOOST_CHECK( size( pair ) == std::distance( pair.first, pair.second ) );
BOOST_CHECK( begin( const_pair ) == const_pair.first );
BOOST_CHECK( end( const_pair ) == const_pair.second );
BOOST_CHECK( empty( const_pair ) == (const_pair.first == const_pair.second) );
BOOST_CHECK( size( const_pair ) == std::size_t( std::distance( const_pair.first, const_pair.second ) ) );
BOOST_CHECK( size( const_pair ) == std::distance( const_pair.first, const_pair.second ) );
BOOST_CHECK( begin( constness_pair ) == constness_pair.first );
BOOST_CHECK( end( constness_pair ) == constness_pair.second );
BOOST_CHECK( empty( constness_pair ) == (constness_pair.first == const_pair.second) );
BOOST_CHECK( size( constness_pair ) == std::size_t( std::distance( constness_pair.first, constness_pair.second ) ) );
BOOST_CHECK( size( constness_pair ) == std::distance( constness_pair.first, constness_pair.second ) );
}

0
test/iterator_range.cpp Executable file → Normal file
View File

0
test/mfc.cpp Executable file → Normal file
View File

8
test/partial_workaround.cpp Executable file → Normal file
View File

@ -10,6 +10,8 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/range/detail/implementation_help.hpp>
#include <boost/test/test_tools.hpp>
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# pragma warn -8091 // supress warning in Boost.Test
@ -30,7 +32,6 @@
#include <boost/static_assert.hpp>
#include <boost/type_traits.hpp>
#include <boost/test/test_tools.hpp>
#include <iostream>
#include <vector>
@ -91,6 +92,11 @@ void check_partial_workaround()
void check_partial_workaround()
{
//
// test if warnings are generated
//
std::size_t s = boost::range_detail::array_size( "foo" );
BOOST_CHECK_EQUAL( s, 4u );
}
#endif

0
test/reversible_range.cpp Executable file → Normal file
View File

4
test/std_container.cpp Executable file → Normal file
View File

@ -48,12 +48,12 @@ void check_std_container()
BOOST_CHECK( begin( vec ) == vec.begin() );
BOOST_CHECK( end( vec ) == vec.end() );
BOOST_CHECK( empty( vec ) == vec.empty() );
BOOST_CHECK( size( vec ) == vec.size() );
BOOST_CHECK( (std::size_t)size( vec ) == vec.size() );
BOOST_CHECK( begin( cvec ) == cvec.begin() );
BOOST_CHECK( end( cvec ) == cvec.end() );
BOOST_CHECK( empty( cvec ) == cvec.empty() );
BOOST_CHECK( size( cvec ) == cvec.size() );
BOOST_CHECK( (std::size_t)size( cvec ) == cvec.size() );
}

34
test/string.cpp Executable file → Normal file
View File

@ -137,14 +137,7 @@ void check_char()
BOOST_CHECK_EQUAL( str_end( char_s ), str_end1 );
BOOST_CHECK_EQUAL( str_empty( char_s ), (char_s == 0 || char_s[0] == char()) );
BOOST_CHECK_EQUAL( sz, std::char_traits<char>::length( char_s ) );
/*
BOOST_CHECK_EQUAL( str_begin( char_s2 ), char_s2 );
std::size_t sz2 = size( char_s2 );
const char* str_end12 = str_begin( char_s2 ) + sz;
BOOST_CHECK_EQUAL( str_end( char_s2 ), str_end12 );
BOOST_CHECK_EQUAL( empty( char_s2 ), (char_s2 == 0 || char_s2[0] == char()) );
BOOST_CHECK_EQUAL( sz2, std::char_traits<char>::length( char_s2 ) );
*/
BOOST_CHECK_EQUAL( str_begin( my_string ), my_string );
range_iterator<char_array_t>::type str_end2 = str_begin( my_string ) + str_size(my_string);
range_iterator<char_array_t>::type str_end3 = str_end(my_string);
@ -165,6 +158,20 @@ void check_char()
BOOST_CHECK( find_const( as_array( my_string ), to_search ) != str_end(my_string) );
BOOST_CHECK( find_const( as_array( my_const_string ), to_search ) != str_end(my_string) );
//
// Test that as_literal() always scan for null terminator
//
char an_array[] = "foo\0bar";
BOOST_CHECK_EQUAL( str_begin( an_array ), an_array );
BOOST_CHECK_EQUAL( str_end( an_array ), an_array + 3 );
BOOST_CHECK_EQUAL( str_size( an_array ), 3 );
const char a_const_array[] = "foobar\0doh";
BOOST_CHECK_EQUAL( str_begin( a_const_array ), a_const_array );
BOOST_CHECK_EQUAL( str_end( a_const_array ), a_const_array + 6 );
BOOST_CHECK_EQUAL( str_size( a_const_array ), 6 );
}
@ -172,9 +179,6 @@ void check_char()
void check_string()
{
check_char();
// check_char<volatile char>();
// check_char<const char>();
// check_char<const volatile char>();
#ifndef BOOST_NO_STD_WSTRING
typedef wchar_t* wchar_iterator_t;
@ -197,13 +201,7 @@ void check_string()
BOOST_CHECK_EQUAL( str_end(char_ws), (str_begin( char_ws ) + sz) );
BOOST_CHECK_EQUAL( str_empty( char_ws ), (char_ws == 0 || char_ws[0] == wchar_t()) );
BOOST_CHECK_EQUAL( sz, std::char_traits<wchar_t>::length( char_ws ) );
/*
std::size_t sz2 = size( char_ws2 );
BOOST_CHECK_EQUAL( str_begin( char_ws2 ), char_ws2 );
BOOST_CHECK_EQUAL( str_end( char_ws2 ), (begin( char_ws2 ) + sz2) );
BOOST_CHECK_EQUAL( empty( char_ws2 ), (char_ws2 == 0 || char_ws2[0] == wchar_t()) );
BOOST_CHECK_EQUAL( sz2, std::char_traits<wchar_t>::length( char_ws2 ) );
*/
wchar_t to_search = L'n';
BOOST_CHECK( find( char_ws, to_search ) != str_end(char_ws) );

0
test/sub_range.cpp Executable file → Normal file
View File