Subject: [Boost-bugs] [Boost C++ Libraries] #1019: iterator_facade::pointer should be the return type of operator-> (DR 445)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-05-30 21:59:50
#1019: iterator_facade::pointer should be the return type of operator-> (DR 445)
--------------------------+-------------------------------------------------
Reporter: Niels Dekker | Type: Bugs
Status: new | Milestone: Boost 1.34.1
Component: iterator | Version: release 1.34.0
Severity: Problem | Keywords:
--------------------------+-------------------------------------------------
The definition of iterator_facade does not agree with the resolution of
Standard Library Defect Report 445, submitted by David Abrahams, 2003-12-
09. [[BR]]
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#445
DR 445 is resolved within the current Draft of the Standard, as follows
(Iterator traits, section 24.3.1):[[BR]]
'' iterator_traits<Iterator>::reference '' [[BR]]
'' iterator_traits<Iterator>::pointer '' [[BR]]
''shall be defined as the iteratorâs reference and pointer types, that is,
for an iterator object a, the same type as the type of *a and a->,
respectively.'' [[BR]]
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2135.pdf
On the other hand, iterator_facade::pointer is a raw pointer, while
iterator_facade::operator->() returns operator_arrow_result::type, which
may be a proxy.
To conform to the resolution of DR 445, iterator_facade::pointer should be
defined as the return type of operator->(), e.g. (assuming that
''raw_pointer'' is the original raw pointer to the value_type):
{{{
typedef typename operator_arrow_result<
value_type
, reference
, raw_pointer
>::type pointer;
}}}
More discussion about this issue:
comp.lang.c++.moderated, Sep 29 2005 [[BR]]
Re: iterator dereference requirements [[BR]]
http://groups.google.com/group/comp.lang.c++.moderated/msg/0f332bcd9a911526
comp.std.c++, March/April 2007 [[BR]]
What should std::InputIterator<T>::pointer be? [n2193 / n2083] [[BR]]
http://groups.google.com/groups/search?q=%22What+should+std%3A%3AInputIterator%3CT%3E%3A%3Apointer+be%3F%22
comp.std.c++, May 2007 [[BR]]
Testing new iterator concepts with ConceptGCC [[BR]]
http://groups.google.com/group/comp.std.c++/tree/browse_frm/thread/9c40ffc2f6394ca0/590e75dfbb993cf6
[I had some e-mail discussion with David Abrahams on this issue as well.]
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1019>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:55 UTC