Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2008-08-19 10:56:38


Author: dgregor
Date: 2008-08-19 10:56:37 EDT (Tue, 19 Aug 2008)
New Revision: 48219
URL: http://svn.boost.org/trac/boost/changeset/48219

Log:
Fix the operator[] requirement in RandomAccessIterator
Text files modified:
   sandbox/committee/concepts/stdlib/clib-iterconcepts.tex | 12 +++++++++++-
   1 files changed, 11 insertions(+), 1 deletions(-)

Modified: sandbox/committee/concepts/stdlib/clib-iterconcepts.tex
==============================================================================
--- sandbox/committee/concepts/stdlib/clib-iterconcepts.tex (original)
+++ sandbox/committee/concepts/stdlib/clib-iterconcepts.tex 2008-08-19 10:56:37 EDT (Tue, 19 Aug 2008)
@@ -273,6 +273,13 @@
   types specified in \tcode{iterator_traits} and allowing us to
   re-instate this user leeway. In [iterator.backward]p2, we clarify
   that we perform this deduction for output iterators.
+\item Added the \tcode{subscript_reference} associated type to the
+ \tcode{RandomAccessIterator} concept, to capture the result of
+ \tcode{operator[]}. This type may need to be a proxy that is
+ different from the \tcode{reference} type, for, e.g., a
+ \tcode{counting_iterator} that meets the \Cpp03
+ \tcode{RandomAccessIterator} requirements. See the reflector thread
+ starting at c++std-lib-22126 for more information.
 \end{itemize}
 
 
@@ -975,6 +982,9 @@
 \color{addclr}
 \begin{itemdecl}
 concept RandomAccessIterator<typename X> : BidirectionalIterator<X>, LessThanComparable<X> {
+ MoveConstructible subscript_reference;
+ requires Convertible<subscript_reference, const value_type&>;
+
   X& operator+=(X&, difference_type);
   X operator+ (const X& x, difference_type n) { X tmp(x); x += n; return x; }
   X operator+ (difference_type n, const X& x) { X tmp(x); x += n; return x; }
@@ -982,7 +992,7 @@
   X operator- (const X& x, difference_type n) { X tmp(x); x -= n; return x; }
 
   difference_type operator-(const X&, const X&);
- reference operator[](const X& x, difference_type n) { return *(x + n); }
+ subscript_reference operator[](const X& x, difference_type n);
 }
 \end{itemdecl}
 \color{black}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk