You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2008/01/07 22:46:34 UTC
[jira] Commented: (STDCXX-612) many iterator types do not work with
types that implement unary operator&
[ https://issues.apache.org/jira/browse/STDCXX-612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556720#action_12556720 ]
Martin Sebor commented on STDCXX-612:
-------------------------------------
We need to be careful here. We can't change [revers.iter.opref] or any other function that deliberately relies on the return type of operator&() being [convertible to] pointer.
As for where things should be defined: _defs.h is for macro definitions only. There shouldn't be any other definitions (types, templates, or functions). As an aside, we should be using C++ casts in favor of the C-style ones.
Here's how I'd like to propose we proceed:
1) First, to simplify things, eliminate the _RWSTD_ARROW() macro. It's a workaround for a compiler limitation that none of our compilers suffers from anymore (check the generated config headers) and so this is a forward compatible change.
2) For standard container iterators define operator->() in terms of the pointer data member as opposed to in terms of operator&() and avoid having to deal with any conversion issues.
3) Leave reverse_iterator::operator->() unchanged (i.e., return &operator*()).
4) Change istream_iterator::operator->() to simply return &_C_val.
5) Change __rw_debug_iter::operator->() to simply return _C_iter.
6) Discuss how to deal with the uninitialized_xxx() algorithms.
> many iterator types do not work with types that implement unary operator&
> -------------------------------------------------------------------------
>
> Key: STDCXX-612
> URL: https://issues.apache.org/jira/browse/STDCXX-612
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 24. Iterators
> Affects Versions: 4.2.0
> Reporter: Travis Vitek
> Assignee: Farid Zaripov
> Fix For: 4.2.1
>
> Attachments: operator_arrow.patch
>
>
> Code that uses the macro _RWSTD_OPERATOR_ARROW will be affected by this issue. Code that has '&*' is also very likely to be affected.
> #include <deque>
> #include <iterator>
> #include <list>
> #include <set>
> #include <vector>
> struct S
> {
> void operator& () const {};
> };
> int main ()
> {
> // this is just a compile test, it is not intended to run
> std::reverse_iterator<S*>().operator->();
> std::set<S>::iterator().operator->();
> std::deque<S>::iterator().operator->();
> std::list<S>::iterator().operator->();
> return 0;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.