Return base by const&

[SVN r21775]
This commit is contained in:
Dave Abrahams
2004-01-15 19:06:25 +00:00
parent 7c784ad112
commit 1e3da4b77f
4 changed files with 18 additions and 23 deletions

View File

@ -133,7 +133,7 @@ class iterator_adaptor
public:
iterator_adaptor();
explicit iterator_adaptor(Base iter);
Base base() const;
Base const base() const;
protected:
Base const& base_reference() const;
Base& base_reference();
@ -229,7 +229,7 @@ expression involving <tt class="literal"><span class="pre">Derived</span></tt> i
</tr>
</tbody>
</table>
<p><tt class="literal"><span class="pre">Base</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
<p><tt class="literal"><span class="pre">Base</span> <span class="pre">const</span> <span class="pre">base()</span> <span class="pre">const;</span></tt></p>
<table class="field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@ -238,6 +238,10 @@ expression involving <tt class="literal"><span class="pre">Derived</span></tt> i
</tr>
</tbody>
</table>
<p>[Note: specifying <tt class="literal"><span class="pre">Base</span> <span class="pre">const</span></tt> gives implementations license to
return <tt class="literal"><span class="pre">Base</span> <span class="pre">const&amp;</span></tt> for efficiency's sake. If <tt class="literal"><span class="pre">base()</span></tt>
returned just <tt class="literal"><span class="pre">Base</span></tt>, it would be possible to call non-<tt class="literal"><span class="pre">const</span></tt>
member functions on the result object directly]</p>
</div>
<div class="section" id="iterator-adaptor-protected-member-functions">
<h2><a class="toc-backref" href="#id12" name="iterator-adaptor-protected-member-functions"><tt class="literal"><span class="pre">iterator_adaptor</span></tt> protected member functions</a></h2>
@ -440,7 +444,6 @@ adaptor, and also <a class="reference" href="counting_iterator.html"><tt class="
<hr class="footer" />
<div class="footer">
<a class="reference" href="iterator_adaptor.rst">View document source</a>.
Generated on: 2004-01-13 19:35 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
</body>