51c43c65646fc6e7116edd94e9ebd73fa961d3c9
[platform/upstream/boost.git] / libs / range / doc / html / range / faq.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>FAQ</title>
5 <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Range 2.0">
8 <link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Range 2.0">
9 <link rel="prev" href="portability.html" title="Portability">
10 <link rel="next" href="history_ack.html" title="History and Acknowledgement">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="portability.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="history_ack.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
27 <a name="range.faq"></a><a class="link" href="faq.html" title="FAQ">FAQ</a>
28 </h2></div></div></div>
29 <p>
30       1. <span class="emphasis"><em><span class="bold"><strong>Why is there no difference between <code class="computeroutput"><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
31       and <code class="computeroutput"><span class="identifier">range_const_iterator</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
32       for <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span><span class="special">&gt;</span></code>?</strong></span></em></span>
33     </p>
34 <div class="blockquote"><blockquote class="blockquote"><p>
35         In general it is not possible nor desirable to find a corresponding <code class="computeroutput"><span class="identifier">const_iterator</span></code>. When it is possible to
36         come up with one, the client might choose to construct a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span><span class="identifier">const_iterator</span><span class="special">,</span><span class="identifier">const_iterator</span><span class="special">&gt;</span></code> object.
37       </p></blockquote></div>
38 <div class="blockquote"><blockquote class="blockquote"><p>
39         Note that an <a class="link" href="reference/utilities/iterator_range.html" title="Class iterator_range"><code class="computeroutput"><span class="identifier">iterator_range</span></code></a> is somewhat more
40         convenient than a <code class="computeroutput"><span class="identifier">pair</span></code> and
41         that a <a class="link" href="reference/utilities/sub_range.html" title="Class sub_range"><code class="computeroutput"><span class="identifier">sub_range</span></code></a> does propagate const-ness.
42       </p></blockquote></div>
43 <p>
44       2. <span class="emphasis"><em><span class="bold"><strong>Why is there not supplied more types or
45       more functions?</strong></span></em></span>
46     </p>
47 <div class="blockquote"><blockquote class="blockquote"><p>
48         The library has been kept small because its current interface will serve
49         most purposes. If and when a genuine need arises for more functionality,
50         it can be implemented.
51       </p></blockquote></div>
52 <p>
53       3. <span class="emphasis"><em><span class="bold"><strong>How should I implement generic algorithms
54       for ranges?</strong></span></em></span>
55     </p>
56 <div class="blockquote"><blockquote class="blockquote"><p>
57         One should always start with a generic algorithm that takes two iterators
58         (or more) as input. Then use Boost.Range to build handier versions on top
59         of the iterator based algorithm. Please notice that once the range version
60         of the algorithm is done, it makes sense not to expose the iterator version
61         in the public interface.
62       </p></blockquote></div>
63 <p>
64       4. <span class="emphasis"><em><span class="bold"><strong>Why is there no Incrementable Range concept?</strong></span></em></span>
65     </p>
66 <div class="blockquote"><blockquote class="blockquote"><p>
67         Even though we speak of incrementable iterators, it would not make much sense
68         for ranges; for example, we cannot determine the size and emptiness of a
69         range since we cannot even compare its iterators.
70       </p></blockquote></div>
71 <div class="blockquote"><blockquote class="blockquote"><p>
72         Note also that incrementable iterators are derived from output iterators
73         and so there exist no output range.
74       </p></blockquote></div>
75 </div>
76 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
77 <td align="left"></td>
78 <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2010 Thorsten Ottosen,
79       Neil Groves<p>
80         Distributed under the Boost Software License, Version 1.0. (See accompanying
81         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
82       </p>
83 </div></td>
84 </tr></table>
85 <hr>
86 <div class="spirit-nav">
87 <a accesskey="p" href="portability.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="history_ack.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
88 </div>
89 </body>
90 </html>