• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Method 1: provide member functions and nested types</title>
5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../index.html" title="Chapter 1. Range 2.0">
8<link rel="up" href="../extending.html" title="Extending the library">
9<link rel="prev" href="../extending.html" title="Extending the library">
10<link rel="next" href="method_2.html" title="Method 2: provide free-standing functions and specialize metafunctions">
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="../extending.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../extending.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="method_2.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="range.reference.extending.method_1"></a><a class="link" href="method_1.html" title="Method 1: provide member functions and nested types">Method 1: provide
28        member functions and nested types</a>
29</h4></div></div></div>
30<p>
31          This procedure assumes that you have control over the types that should
32          be made conformant to a Range concept. If not, see <a class="link" href="method_2.html" title="Method 2: provide free-standing functions and specialize metafunctions">method
33          2</a>.
34        </p>
35<p>
36          The primary templates in this library are implemented such that standard
37          containers will work automatically and so will <a href="../../../../../../../libs/array/index.html" target="_top">boost::array</a>.
38          Below is given an overview of which member functions and member types a
39          class must specify to be useable as a certain Range concept.
40        </p>
41<div class="informaltable"><table class="table">
42<colgroup>
43<col>
44<col>
45</colgroup>
46<thead><tr>
47<th>
48                  <p>
49                    Member function
50                  </p>
51                </th>
52<th>
53                  <p>
54                    Related concept
55                  </p>
56                </th>
57</tr></thead>
58<tbody>
59<tr>
60<td>
61                  <p>
62                    <code class="computeroutput"><span class="identifier">begin</span><span class="special">()</span></code>
63                  </p>
64                </td>
65<td>
66                  <p>
67                    <a class="link" href="../../concepts/single_pass_range.html" title="Single Pass Range">Single Pass
68                    Range</a>
69                  </p>
70                </td>
71</tr>
72<tr>
73<td>
74                  <p>
75                    <code class="computeroutput"><span class="identifier">end</span><span class="special">()</span></code>
76                  </p>
77                </td>
78<td>
79                  <p>
80                    <a class="link" href="../../concepts/single_pass_range.html" title="Single Pass Range">Single Pass
81                    Range</a>
82                  </p>
83                </td>
84</tr>
85</tbody>
86</table></div>
87<p>
88          Notice that <code class="computeroutput"><span class="identifier">rbegin</span><span class="special">()</span></code>
89          and <code class="computeroutput"><span class="identifier">rend</span><span class="special">()</span></code>
90          member functions are not needed even though the container can support bidirectional
91          iteration.
92        </p>
93<p>
94          The required member types are:
95        </p>
96<div class="informaltable"><table class="table">
97<colgroup>
98<col>
99<col>
100</colgroup>
101<thead><tr>
102<th>
103                  <p>
104                    Member type
105                  </p>
106                </th>
107<th>
108                  <p>
109                    Related concept
110                  </p>
111                </th>
112</tr></thead>
113<tbody>
114<tr>
115<td>
116                  <p>
117                    <code class="computeroutput"><span class="identifier">iterator</span></code>
118                  </p>
119                </td>
120<td>
121                  <p>
122                    <a class="link" href="../../concepts/single_pass_range.html" title="Single Pass Range">Single Pass
123                    Range</a>
124                  </p>
125                </td>
126</tr>
127<tr>
128<td>
129                  <p>
130                    <code class="computeroutput"><span class="identifier">const_iterator</span></code>
131                  </p>
132                </td>
133<td>
134                  <p>
135                    <a class="link" href="../../concepts/single_pass_range.html" title="Single Pass Range">Single Pass
136                    Range</a>
137                  </p>
138                </td>
139</tr>
140</tbody>
141</table></div>
142<p>
143          Again one should notice that member types <code class="computeroutput"><span class="identifier">reverse_iterator</span></code>
144          and <code class="computeroutput"><span class="identifier">const_reverse_iterator</span></code>
145          are not needed.
146        </p>
147</div>
148<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
149<td align="left"></td>
150<td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen,
151      Neil Groves<p>
152        Distributed under the Boost Software License, Version 1.0. (See accompanying
153        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>)
154      </p>
155</div></td>
156</tr></table>
157<hr>
158<div class="spirit-nav">
159<a accesskey="p" href="../extending.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../extending.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="method_2.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
160</div>
161</body>
162</html>
163