Merged revisions 40922-40969 via svnmerge from

https://svn.boost.org/svn/boost/trunk

........
  r40923 | eric_niebler | 2007-11-07 22:48:08 -0800 (Wed, 07 Nov 2007) | 1 line
  
  fix errors and warnings on msvc-9
........
  r40924 | chris_kohlhoff | 2007-11-07 23:52:49 -0800 (Wed, 07 Nov 2007) | 2 lines
  
  Fix timer stalls.
........
  r40925 | johnmaddock | 2007-11-08 01:38:22 -0800 (Thu, 08 Nov 2007) | 1 line
  
  Fixed license text.
........
  r40926 | bemandawes | 2007-11-08 04:35:50 -0800 (Thu, 08 Nov 2007) | 1 line
  
  Borland appends newline, so just check text
........
  r40927 | johnmaddock | 2007-11-08 04:39:58 -0800 (Thu, 08 Nov 2007) | 1 line
  
  Removed non-BSL files, updated and regenerated docs accordingly.
........
  r40928 | bemandawes | 2007-11-08 05:01:23 -0800 (Thu, 08 Nov 2007) | 1 line
  
  Markup older Borland compilers that don't support enable_if
........
  r40932 | bemandawes | 2007-11-08 06:25:09 -0800 (Thu, 08 Nov 2007) | 1 line
  
  Clarify comment
........
  r40934 | joaquin | 2007-11-08 07:46:57 -0800 (Thu, 08 Nov 2007) | 1 line
  
  removed markup for a fixed failure of multi_index on vacpp
........
  r40935 | nikiml | 2007-11-08 08:28:44 -0800 (Thu, 08 Nov 2007) | 1 line
  
  changed handle cast to downcast
........
  r40936 | hljin | 2007-11-08 09:31:56 -0800 (Thu, 08 Nov 2007) | 1 line
  
  GIL: added missing standard C++ header files
........
  r40937 | hljin | 2007-11-08 09:35:37 -0800 (Thu, 08 Nov 2007) | 1 line
  
  GIL: added namespace prefix to avoid confusion
........
  r40938 | danieljames | 2007-11-08 10:04:12 -0800 (Thu, 08 Nov 2007) | 3 lines
  
  Remove the <small> from the copyright footer, because it was causing the markup
  to be invalid.
........
  r40939 | johnmaddock | 2007-11-08 10:05:28 -0800 (Thu, 08 Nov 2007) | 1 line
  
  Applied fix from http://svn.boost.org/trac/boost/ticket/1023.
........
  r40956 | vladimir_prus | 2007-11-09 00:26:47 -0800 (Fri, 09 Nov 2007) | 1 line
  
  Don't use toolset.register
........
  r40957 | vladimir_prus | 2007-11-09 00:30:27 -0800 (Fri, 09 Nov 2007) | 2 lines
  
  Remove toolset.register.
........
  r40958 | speedsnail | 2007-11-09 00:31:45 -0800 (Fri, 09 Nov 2007) | 2 lines
  
  Force static linking for toolsets mingw and boorland.
........
  r40959 | speedsnail | 2007-11-09 01:28:29 -0800 (Fri, 09 Nov 2007) | 1 line
  
  Reverted the previous commit, until I find a better solution...
........
  r40960 | johnmaddock | 2007-11-09 01:54:43 -0800 (Fri, 09 Nov 2007) | 1 line
  
  Still trying to get the Solaris error rates correct....
........
  r40961 | johnmaddock | 2007-11-09 01:59:37 -0800 (Fri, 09 Nov 2007) | 1 line
  
  Trivial fix for issue #647.
........
  r40962 | nesotto | 2007-11-09 02:27:42 -0800 (Fri, 09 Nov 2007) | 1 line
  
  major update wrt. new range concepts
........
  r40963 | johnmaddock | 2007-11-09 03:01:45 -0800 (Fri, 09 Nov 2007) | 1 line
  
  Improved error messages and added tentative fixes for HP Tru64: the compiler appears to store constants that should underflow to zero as a small non-zero values which messes up the logic used in the test cases.
........
  r40964 | nesotto | 2007-11-09 05:13:06 -0800 (Fri, 09 Nov 2007) | 1 line
  
  minor editorial issue
........
  r40965 | nesotto | 2007-11-09 05:30:57 -0800 (Fri, 09 Nov 2007) | 1 line
  
  update of new concepts, and replacement of range_size<T>::type with range_difference<T>::type throughut the library
........
  r40966 | nesotto | 2007-11-09 05:31:43 -0800 (Fri, 09 Nov 2007) | 1 line
  
  minor tweaks to avoid warnings ... extension mechanism updated to follow new protocol
........
  r40967 | schoepflin | 2007-11-09 06:25:44 -0800 (Fri, 09 Nov 2007) | 1 line
  
  Added memory barriers to Tru64 atomic ops.
........
  r40968 | nesotto | 2007-11-09 07:15:28 -0800 (Fri, 09 Nov 2007) | 1 line
  
  improved reference
........
  r40969 | johnmaddock | 2007-11-09 08:57:42 -0800 (Fri, 09 Nov 2007) | 1 line
  
  Added needed macro suppression to use of isfinite.
........


[SVN r40970]
This commit is contained in:
Eric Niebler
2007-11-09 17:28:34 +00:00
parent de8f941720
commit e9a4a0d7aa
16 changed files with 539 additions and 460 deletions

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 </span><span class=keyword>struct </span><a href="#range_value"><span
class=identifier>range_value</span></a><span class=special>; 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>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 </span><span class=keyword>struct </span><a href="#range_pointer"><span
class=identifier>range_pointer</span></a><span class=special>; 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 </span><span class=keyword>struct </span><a
href="#range_reverse_iterator"><span href="#range_reverse_iterator"><span
class=identifier>range_reverse_iterator</span></a><span class=special>; 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>// </span><span class=comment>//
// Single Pass Range functions // 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>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><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>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><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>c </span><span class=special>); </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>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><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>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><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>c </span><span class=special>); </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>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><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>// </span><span class=comment>//
// Forward Range functions // 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>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><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>// </span><span class=comment>//
// Bidirectional Range functions // 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>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=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>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="#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><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>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=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>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 </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><span class=comment>// </span><span class=comment>//
// Random Access Range functions // 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>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><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><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>// <span class=comment>//
// Special const Range functions // 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> <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> <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 class=special>} </span><span class=comment>// namespace 'boost'
</span> </span>
</pre> </pre>
@ -244,88 +259,79 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<th> <th>
Complexity</th> Complexity</th>
</tr> </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> <tr>
<a name="range_iterator"></a> <a name="range_iterator"></a>
<td><code>range_iterator&lt;X&gt;::type</code></td> <td><code>range_iterator&lt;X&gt;::type</code></td>
<td><code>T::iterator</code><br> <td><code>T::iterator</code><br>
<code>P::first_type</code><br> <code>P::first_type</code><br>
<code>A*</code><br> <code>A*</code><br>
<code>Char*</code>
<td>compile time</td> <td>compile time</td>
</tr> </tr>
<tr> <tr>
<a name="range_const_iterator"></a> <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> <td><code>T::const_iterator</code><br>
<code>P::first_type</code><br> <code>P::first_type</code><br>
<code>const A*</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> <td>compile time</td>
</tr> </tr>
<tr> <tr>
<a name="range_difference"></a> <a name="range_difference"></a>
<td><code>range_difference&lt;X&gt;::type</code></td> <td><code>range_difference&lt;X&gt;::type</code></td>
<td><code>T::difference_type</code><br> <td>
<code>boost::iterator_difference&lt;P::first_type&gt;::type</code><br> <code>boost::iterator_difference&lt;range_iterator&lt;X&gt;::type&gt;::type</code></td>
<code>std::ptrdiff_t</code><br>
<code>std::ptrdiff_t</code><br>
<td>compile time</td> <td>compile time</td>
</tr> </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>
<tr> <tr>
<a name="range_reverse_iterator"></a> <a name="range_reverse_iterator"></a>
<td><code>range_reverse_iterator&lt;X&gt;::type</code></td> <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> <td>compile time</td>
</tr> </tr>
<tr> <tr>
<a name="range_const_reverse_iterator"></a> <a name="range_const_reverse_iterator"></a>
<td><code>range_const_reverse_iterator&lt;X&gt;::type</code></td> <td><code>range_reverse_iterator&lt;const X&gt;::type</code></td>
<td><code>boost::reverse_iterator&lt; typename range_const_iterator&lt;T&gt;::type &gt;</code> <td><code>boost::reverse_iterator&lt;range_iterator&lt;const X&gt;::type&gt;</code>
<br> <br>
<td>compile time</td> <td>compile time</td>
</tr> </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> </table>
</p> </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> <h4>Functions</h4>
<p> <p>
<table border="1" cellpadding="5"> <table border="1" cellpadding="5">
@ -342,12 +348,11 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<tr> <tr>
<a name="begin"></a> <a name="begin"></a>
<td><code>begin(x)</code></td> <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> <td>
<code>p.first</code> if <code>p</code> is of type <code>std::pair&ltT&gt;<code><br> <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>a</code> if <code>a</code> is an array <br>
<code>s</code> if <code>s</code> is a string literal<br> <code>range_begin(x)</code> if that expression would invoke a function found by ADL <br>
<code>boost_range_begin(x)</code> if that expression would invoke a function found by ADL <br>
<code>t.begin()</code> otherwise <code>t.begin()</code> otherwise
<td>constant time</td> <td>constant time</td>
@ -355,106 +360,133 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<tr> <tr>
<a name="end"></a> <a name="end"></a>
<td><code>end(x)</code></td> <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> <td>
<code>p.second</code> if <code>p</code> is of type <code>std::pair&ltT&gt;<code><br> <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>a + sz</code> if <code>a</code> is an array of size <code>sz</code>
<code>s + std::char_traits&lt;X&gt;::length( s )</code> if <code>s</code> is a <code>Char*</code>
<br> <br>
<code>s + sz - 1</code> if <code>s</code> is a string literal of size <code>sz</code> <code>range_end(x)</code> if that expression would invoke a function found by ADL <br>
<br>
<code>boost_range_end(x)</code> if that expression would invoke a function found by ADL <br>
<code>t.end()</code> otherwise <code>t.end()</code> otherwise
<td>linear if <code>X</code> is <code>Char*</code> <td>
<br> constant time </td>
constant time otherwise</td>
</tr> </tr>
<tr> <tr>
<a name="empty"></a> <a name="empty"></a>
<td><code>empty(x)</code></td> <td><code>empty(x)</code></td>
<td><code>bool</code></td> <td><code>bool</code></td>
<td><code>begin(x) == end( x )</code><br> <td><code>boost::begin(x) == boost::end(x)</code><br>
<td>linear if <code>X</code> is <code>Char*</code> <td> constant time <br>
<br>
constant time otherwise<br>
</td> </td>
</tr> </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> <tr>
<a name="size"></a> <a name="size"></a>
<td><code>size(x)</code></td> <td><code>size(x)</code></td>
<td><code>range_size&lt;X&gt;::type</code></td> <td><code>range_difference&lt;X&gt;::type</code></td>
<td> <td><code> boost::end(x) - boost::begin(x)</code>
<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> <td> constant time </td>
<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>
</tr> </tr>
<tr> <tr>
<a name="rbegin"></a> <a name="rbegin"></a>
<td><code>rbegin(x)</code></td> <td><code>rbegin(x)</code></td>
<td><code>range_reverse_result_iterator&lt;X&gt;::type</code></td> <td><code>range_reverse_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( boost::end(x) )</code>
<br> <br>
<td>same as <code>end(x)</code> <td>constant time
</td> </td>
</tr> </tr>
<tr> <tr>
<a name="rend"></a> <a name="rend"></a>
<td><code>rend(x)</code></td> <td><code>rend(x)</code></td>
<td><code>range_reverse_result_iterator&lt;X&gt;::type</code></td> <td><code>range_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>range_reverse_result_iterator&lt;X&gt;::type( begin(x) )</code> <td><code>range_reverse_iterator&lt;X&gt;::type( boost::begin(x) )</code>
<td>same as <code>begin(x)</code></td> <td>constant time</td>
</tr> </tr>
<tr> <tr>
<a name="const_begin"></a> <a name="const_begin"></a>
<td><code>const_begin(x)</code></td> <td><code>const_begin(x)</code></td>
<td><code>range_const_iterator&lt;X&gt;::type</code></td> <td><code>range_iterator&lt;const 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( boost::begin(x) )</code>
<br> <br>
<td>same as <code>begin(x)</code> <td>constant time
</td> </td>
</tr> </tr>
<tr> <tr>
<a name="const_end"></a> <a name="const_end"></a>
<td><code>const_end(x)</code></td> <td><code>const_end(x)</code></td>
<td><code>range_const_iterator&lt;X&gt;::type</code></td> <td><code>range_iterator&lt;const X&gt;::type</code></td>
<td><code>range_const_iterator&lt;X&gt;::type( end(x) )</code> <td><code>range_iterator&lt;const X&gt;::type( boost::end(x) )</code>
<td>same as <code>end(x)</code></td> <td>constant time</td>
</tr> </tr>
<tr> <tr>
<a name="const_rbegin"></a> <a name="const_rbegin"></a>
<td><code>const_rbegin(x)</code></td> <td><code>const_rbegin(x)</code></td>
<td><code>range_const_reverse_iterator&lt;X&gt;::type</code></td> <td><code>range_reverse_iterator&lt;const 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( boost::rbegin(x) )</code>
<br> <br>
<td>same as <code>rbegin(x)</code> <td>constant time
</td> </td>
</tr> </tr>
<tr> <tr>
<a name="const_rend"></a> <a name="const_rend"></a>
<td><code>const_rend(x)</code></td> <td><code>const_rend(x)</code></td>
<td><code>range_const_reverse_iterator&lt;X&gt;::type</code></td> <td><code>range_reverse_iterator&lt;const X&gt;::type</code></td>
<td><code>range_const_reverse_iterator&lt;X&gt;::type( rend(x) )</code> <td><code>range_reverse_iterator&lt;const X&gt;::type( boost::rend(x) )</code>
<td>same as <code>rend(x)</code></td>
<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>
</table> </table>
</p> </p>
<p> <p>
The special <code>const</code> functions are not part of any Range concept, but The special <code>const_</code>-named functions are useful when you
are very useful when you want to document clearly that your code is read-only. want to document clearly that your code is read-only.
</p> </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> <hr>
<a name="minimal_interface"></a> <a name="minimal_interface"></a>
<h3>Extending the library</h3> <h3>Extending the library</h3>
<ul> <ul>
<li><a href="#method1">Method 1: provide member functions and nested types</a></li> <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> <li><a href="#method2">Method 2: provide free-standing functions and specialize metafunctions</a></li>
</ul> </ul>
@ -491,10 +523,6 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
</td> </td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td> <td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr> </tr>
<tr>
<td><code>size()</code></td>
<td><a href="range.html#forward_range">Forward Range</a></td>
</tr>
</table> </table>
</p> </p>
<p> <p>
@ -520,10 +548,6 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<td><code>const_iterator</code></td> <td><code>const_iterator</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td> <td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr> </tr>
<tr>
<td><code>size_type</code></td>
<td><a href="range.html#forward_range">Forward Range</a></td>
</tr>
</table> </table>
</p> </p>
<p> <p>
@ -554,26 +578,23 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<th> <th>
Related concept</th> Related concept</th>
<tr> <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> <td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr> </tr>
<tr> <tr>
<td><code>boost_range_end(x)</code> <td><code>range_end(x)</code>
</td> </td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td> <td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr> </tr>
<tr>
<td><code>boost_range_size(x)</code></td>
<td><a href="range.html#forward_range">Forward Range</a></td>
</tr>
</table> </table>
</p> </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. overloaded for both <code>const</code> and mutable reference arguments.
</p> </p>
<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>
<p> <p>
<table cellpadding="5" border="1" ID="Table2"> <table cellpadding="5" border="1" ID="Table2">
@ -583,17 +604,14 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<th> <th>
Related concept</th> Related concept</th>
<tr> <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> <td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr> </tr>
<tr> <tr>
<td><code>boost::range_const_iterator</code></td> <td><code>boost::range_const_iterator</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td> <td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr> </tr>
<tr>
<td><code>boost::range_size</code></td>
<td><a href="range.html#forward_range">Forward Range</a></td>
</tr>
</table> </table>
</p> </p>
<p> <p>
@ -627,7 +645,7 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
//</span> //</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>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=special>{</span>
<span class=keyword>typedef</span> <span class=identifier>T</span> <span class=identifier>type</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> <span class=special>};</span>
@ -636,20 +654,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=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=special>{</span>
<span class=comment>// <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 // because the 'Pair' type does not distinguish
// between an iterator and a const_iterator. // between an iterator and a const_iterator.
//</span> //</span>
<span class=keyword>typedef</span> <span class=identifier>T</span> <span class=identifier>type</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> <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=special>}</span> <span class=comment>// namespace 'boost'</span>
<span class=keyword>namespace</span> <span class=identifier>Foo</span> <span class=keyword>namespace</span> <span class=identifier>Foo</span>
@ -661,36 +672,29 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
//</span> //</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>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=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=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=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>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=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=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=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>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=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=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=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>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=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=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=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=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> <span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>vector</span><span class=special>&gt;</span>
@ -699,7 +703,7 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<span class=special>{</span> <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=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>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=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>// <span class=comment>//
// Notice that we call 'begin' etc with qualification. // Notice that we call 'begin' etc with qualification.
@ -708,9 +712,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>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>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>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>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>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=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> <span class=special>}</span>
@ -719,7 +723,7 @@ class=identifier>T</span><span class=special>&amp; </span><span class=identifier
<hr> <hr>
<p> <p>
(C) Copyright Thorsten Ottosen 2003-2004 (C) Copyright Thorsten Ottosen 2003-2007
</p> </p>
<br> <br>
<br> <br>

View File

@ -26,10 +26,6 @@
</li> </li>
shows how to implement a container version of <code >std::find()</code> that shows how to implement a container version of <code >std::find()</code> that
works with <code >char[],wchar_t[],char*,wchar_t*.</code> 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 > <li >
<a href="../test/algorithm_example.cpp" target="_self" ><code >algorithm_example.cpp</code></a> <a href="../test/algorithm_example.cpp" target="_self" ><code >algorithm_example.cpp</code></a>

View File

@ -35,16 +35,14 @@
enough functionality to satisfy the needs of the generic code enough functionality to satisfy the needs of the generic code
<i>if a suitable layer of indirection is applied </i>. For <i>if a suitable layer of indirection is applied </i>. For
example, raw arrays are often suitable for use with generic code that example, raw arrays are often suitable for use with generic code that
works with containers, provided a suitable adapter is used. Likewise, null works with containers, provided a suitable adapter is used.
terminated strings can be treated as containers of characters, if suitably
adapted.
</p> </p>
<p> <p>
This library therefore provides the means to adapt standard-like This library therefore provides the means to adapt standard-like
containers, containers, <code>std::pairs</code> of iterators, and raw arrays (and
null terminated strings, <code>std::pairs</code> of iterators, and raw more), such that
arrays (and more), such that the same generic code can work with them all. the same generic code can work with them all.
The basic idea is to add another layer of indirection using <a The basic idea is to add another layer of indirection using <a
href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a> and href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a> and
free-standing functions so syntactic and/or semantic differences can be removed. free-standing functions so syntactic and/or semantic differences can be removed.

View File

@ -3,14 +3,289 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <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> <title>Boost Range MFC/ATL Extension</title>
<meta name="author" content="Shunsuke Sogame" /> <meta name="author" content="Shunsuke Sogame" />
<meta name="date" content="26th of May 2006" /> <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)." /> <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"> <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> </style>
</head> </head>
@ -33,7 +308,7 @@
</table> </table>
<div class="section"> <div class="section">
<h1><a id="overview" name="overview">Overview</a></h1> <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"> <pre class="literal-block">
CTypedPtrArray&lt;CPtrArray, CList&lt;CString&gt; *&gt; myArray; CTypedPtrArray&lt;CPtrArray, CList&lt;CString&gt; *&gt; myArray;
... ...
@ -64,7 +339,7 @@ BOOST_FOREACH (CList&lt;CString&gt; *theList, myArray)
</div> </div>
<div class="section"> <div class="section">
<h1><a id="mfc-ranges" name="mfc-ranges">MFC Ranges</a></h1> <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 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> 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"> <table border="1" class="docutils">
@ -170,7 +445,7 @@ The table below lists the Traversal Category and <tt class="docutils literal"><s
</tr> </tr>
</tbody> </tbody>
</table> </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>. 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_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 <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>
<div class="section"> <div class="section">
<h1><a id="atl-ranges" name="atl-ranges">ATL Ranges</a></h1> <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 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> 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"> <table border="1" class="docutils">
@ -265,7 +540,7 @@ The table below lists the Traversal Category and <tt class="docutils literal"><s
</tr> </tr>
</tbody> </tbody>
</table> </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>. 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_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 <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 else
return ReF return ReF
</pre> </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_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_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> <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"> <div class="section">
<h1><a id="references" name="references">References</a></h1> <h1><a id="references" name="references">References</a></h1>
<ul class="simple"> <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/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> <li><a class="reference" href="http://msdn2.microsoft.com/en-US/library/15e672bd.aspx">ATL Collection Classes</a></li>
</ul> </ul>
</div> </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> </div>
</body> </body>
</html> </html>

View File

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

View File

@ -36,7 +36,7 @@ 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. Notice also that some compilers cannot do function template ordering properly.
In that case one must rely of <a In that case one must rely of <a
href="boost_range.html#range_result_iterator"><code >range_result_iterator</code></a> href="boost_range.html#range_iterator"><code >range_iterator</code></a>
and a single function definition instead of overloaded versions for const and and a single function definition instead of overloaded versions for const and
non-const arguments. non-const arguments.

View File

@ -50,7 +50,7 @@
Range provides iterators for accessing a half-open range Range provides iterators for accessing a half-open range
<code>[first,one_past_last)</code> of elements and provides <code>[first,one_past_last)</code> of elements and provides
information about the number of elements in the Range. However, a Range has 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>
<p> <p>
The motivation for the Range concept is The motivation for the Range concept is
@ -78,9 +78,9 @@
The operations that can be performed on a Range is dependent on the 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 <a href="../../iterator/doc/new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal">traversal
category</a> of the underlying iterator type. Therefore category</a> of the underlying iterator type. Therefore
the range concepts are named to reflect which traversal category its the range concepts are named to reflect which traversal category their
iterators support. See also <a href="style.html">terminology and style guidelines.</a> iterators support. See also <a href="style.html">terminology and style
for more information about naming of ranges.</p> guidelines.</a> for more information about naming of ranges.</p>
<p> The concepts described below specifies associated types as <p> The concepts described below specifies associated types as
<a href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a> and all <a href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a> and all
@ -118,11 +118,7 @@ Single Pass Iterator</a>
<h3>Associated types</h3> <h3>Associated types</h3>
<table border="1" cellpadding="5"> <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> <TR>
<TD VAlign="top">Iterator type</TD> <TD VAlign="top">Iterator type</TD>
<TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code></TD> <TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code></TD>
@ -132,7 +128,7 @@ Single Pass Iterator</a>
</TR> </TR>
<TR> <TR>
<TD VAlign="top">Const iterator type</TD> <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 <TD VAlign="top">A type of iterator that may be used to examine, but not to
modify, a Range's elements.</TD> modify, a Range's elements.</TD>
</TR> </TR>
@ -161,20 +157,16 @@ Single Pass Iterator</a>
<TD VAlign="top">Beginning of range</TD> <TD VAlign="top">Beginning of range</TD>
<TD VAlign="top"><code>boost::begin(a)</code></TD> <TD VAlign="top"><code>boost::begin(a)</code></TD>
<TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code> if <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> otherwise</TD> </TR>
<TR> <TR>
<TD VAlign="top">End of range</TD> <TD VAlign="top">End of range</TD>
<TD VAlign="top"><code>boost::end(a)</code></TD> <TD VAlign="top"><code>boost::end(a)</code></TD>
<TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code> if <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> otherwise</TD>
</TR> </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> </table>
<h3>Expression semantics</h3> <h3>Expression semantics</h3>
@ -188,7 +180,7 @@ otherwise</TD>
<TD VAlign="top"><code>boost::begin(a)</code></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">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. <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>
<TR> <TR>
<TD VAlign="top"><code>boost::end(a)</code></TD> <TD VAlign="top"><code>boost::end(a)</code></TD>
@ -196,19 +188,14 @@ otherwise</TD>
Range.</TD> Range.</TD>
<TD VAlign="top"><code>boost::end(a)</code> is past-the-end.</TD> <TD VAlign="top"><code>boost::end(a)</code> is past-the-end.</TD>
</TR> </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> </table>
<h3>Complexity guarantees</h3> <h3>Complexity guarantees</h3>
All three functions are at most amortized linear time. For most practical <code>boost::end(a)</code> is at most amortized linear time, <code>boost::begin(a)</code> is
purposes, one can expect <code>boost::begin(a)</code>, <code>boost::end(a)</code> and <code>boost::empty(a)</code> amortized constant time. For most practical
to be amortized constant time. purposes, one can expect both to be amortized constant time.
<h3>Invariants</h3> <h3>Invariants</h3>
<Table border> <Table border>
@ -227,14 +214,17 @@ otherwise</TD>
<h3>See also</h3> <h3>See also</h3>
<p> <p><a
<A href="http://www.sgi.com/Technology/STL/Container.html">Container</A> href="boost_range.html#minimal_interface">Extending the library for UDTs </a></p>
</p> <p> <a href="boost_range.html#boost::rang_difference">Implementation of
<p> <a href="boost_range.html#boost::range_value">implementation of
metafunctions </a></p> metafunctions </a></p>
<p> <a href="boost_range.html#begin">implementation of <p> <a href="boost_range.html#begin">Implementation of
functions </a></p> functions </a></p>
<p>
<A href="http://www.sgi.com/Technology/STL/Container.html">Container</A>
</p>
<hr> <hr>
<a name=forward_range><h2>Forward Range</h2> <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 <h3>Refinement of</h3> <a href="#single_pass_range">Single Pass
Range</a> Range</a>
<h3>Associated types</h3> </p>
<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>
<hr> <hr>
<a name="bidirectional_range"><h2>Bidirectional Range</h2> <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>Refinement of</h3> <a href="#forward_range">Forward Range</a>
<h3>Associated types</h3>
</p>
<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>
<hr> <hr>
@ -455,7 +302,7 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator
<a name=concept_checking><h2>Concept Checking</h2> <a name=concept_checking><h2>Concept Checking</h2>
Each of the range concepts has a corresponding concept checking 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 used in conjunction with the <a
href="../../concept_check/concept_check.htm">Boost Concept href="../../concept_check/concept_check.htm">Boost Concept
Check</a> library to insure that the type of a template parameter Check</a> library to insure that the type of a template parameter
@ -529,7 +376,7 @@ href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterator
<TD><A HREF=http://www.boost.org/people/jeremy_siek.htm>Jeremy Siek</A> <TD><A HREF=http://www.boost.org/people/jeremy_siek.htm>Jeremy Siek</A>
</TR> </TR>
<tr > <tr >
<TD nowrap>Copyright &copy 2004</TD> <TD nowrap>Copyright &copy 2004-2007</TD>
<TD>Thorsten Ottosen. <TD>Thorsten Ottosen.
</TABLE> </TABLE>

View File

@ -59,19 +59,16 @@ corresponding <code>const_iterator</code> is. </p>
<p> <p>
If the template argument is not a model of Forward Traversal Iterator, one can 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 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. Pass Iterators.
</p> </p>
<p> <p>
Recall that many default constructed iterators Recall that many default constructed iterators
are <i>singular</i> and hence can only be assigned, but not compared or are <i>singular</i> and hence can only be assigned, but not compared or
incremented or anything. However, if one creates a default constructed incremented or anything. Likewise, if one creates a default constructed
<code>iterator_range</code>, then one <code>iterator_range</code>, then one have to be careful about not doing
can still call all its member functions. This means that the anything besides copying. </p>
<code>iterator_range</code> will still be usable in many contexts even
though the iterators underneath are not.
</p>
<h3>Synopsis</h3> <h3>Synopsis</h3>
@ -82,9 +79,6 @@ corresponding <code>const_iterator</code> is. </p>
</span><span class=keyword>class </span><span class=identifier>iterator_range </span><span class=keyword>class </span><span class=identifier>iterator_range
</span><span class=special>{ </span><span class=special>{
</span><span class=keyword>public</span><span class=special>: </span><span class=comment>// Forward Range types </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>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>const_iterator</span><span class=special>;
@ -117,10 +111,11 @@ class=identifier><a href="#equal">equal</a></span><span
class=special>( </span><span class=keyword>const <span class=special>( </span><span class=keyword>const <span
class=identifier>iterator_range</span><span class=special>& ) </span><span class=identifier>iterator_range</span><span class=special>& ) </span><span
class=keyword>const;</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>reference</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>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=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>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>cial>&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><span class=special>}; </span><span class=special>};
</span><span class=comment>// stream output </span><span class=comment>// stream output

View File

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

View File

@ -73,7 +73,7 @@ namespace boost
template< class Left, class Right > template< class Left, class Right >
inline bool equal( const Left& l, const Right& r ) 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 ), sz_type l_size = boost::size( l ),
r_size = boost::size( r ); r_size = boost::size( r );
@ -166,20 +166,7 @@ namespace boost
, singular( true ) , singular( true )
#endif #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 //! Constructor from a pair of iterators
template< class Iterator > template< class Iterator >
iterator_range( Iterator Begin, Iterator End ) : iterator_range( Iterator Begin, Iterator End ) :
@ -283,7 +270,7 @@ namespace boost
return m_End; return m_End;
} }
size_type size() const difference_type size() const
{ {
BOOST_ASSERT( !is_singular() ); BOOST_ASSERT( !is_singular() );
return m_End - m_Begin; return m_End - m_Begin;
@ -351,9 +338,9 @@ namespace boost
return *--last; 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]; return m_Begin[at];
} }
@ -362,9 +349,9 @@ namespace boost
// fails because it returns by reference. Therefore // fails because it returns by reference. Therefore
// operator()() is provided for these cases. // operator()() is provided for these cases.
// //
value_type operator()( size_type at ) const value_type operator()( difference_type at ) const
{ {
BOOST_ASSERT( at < size() ); BOOST_ASSERT( at >= 0 && at < size() );
return m_Begin[at]; return m_Begin[at];
} }

View File

@ -17,14 +17,17 @@
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/size_type.hpp> #include <boost/range/difference_type.hpp>
#include <boost/assert.hpp>
namespace boost namespace boost
{ {
template< class T > 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 ); return boost::end( r ) - boost::begin( r );
} }

View File

@ -38,6 +38,7 @@ namespace boost
typedef BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type const_iterator; 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_difference<ForwardRange>::type difference_type;
typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type; typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type;
typedef BOOST_DEDUCED_TYPENAME base::reference reference;
public: public:
sub_range() : base() sub_range() : base()
@ -100,11 +101,11 @@ namespace boost
const_iterator begin() const { return base::begin(); } const_iterator begin() const { return base::begin(); }
iterator end() { return base::end(); } iterator end() { return base::end(); }
const_iterator end() const { 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 public: // convenience
value_type& front() reference front()
{ {
return base::front(); return base::front();
} }
@ -114,7 +115,7 @@ namespace boost
return base::front(); return base::front();
} }
value_type& back() reference back()
{ {
return base::back(); return base::back();
} }
@ -124,12 +125,12 @@ namespace boost
return base::back(); return base::back();
} }
value_type& operator[]( size_type sz ) reference operator[]( difference_type sz )
{ {
return base::operator[](sz); return base::operator[](sz);
} }
const value_type& operator[]( size_type sz ) const const value_type& operator[]( difference_type sz ) const
{ {
return base::operator[](sz); return base::operator[](sz);
} }

View File

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

View File

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

View File

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

View File

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