stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Vitek (JIRA)" <>
Subject [jira] Commented: (STDCXX-612) many iterator types do not work with types that implement unary operator&
Date Tue, 20 Nov 2007 18:42:43 GMT


Travis Vitek commented on STDCXX-612:

Also, some places in the standard have `Returns' and `Effects' clauses that say that the operator->()
is supposed to return some specific thing. For example, [revers.iter.opref] has
an effects clause that claims `pointer operator->() const' returns &(operator*()).
Of course, with that said, there is nothing that says how container iterators should behave
when this situation comes up for their forward iterators. It seems to indicate that the containers
should use reverse_iterator for their reverse iterator implementation, which, as mentioned
above, is essentially required to not work with types that implement operator& to do something

If we make some of these changes it will make our implementation non-compliant, which may
be a bad thing. This is one of those issues where it might need to be brought up with the
committee for discussion before we have a complete and satisfying solution. Of course the
standards committee might have already covered this issue at one point, but if they have,
they haven't documented it very well.

> many iterator types do not work with types that implement unary operator&
> -------------------------------------------------------------------------
>                 Key: STDCXX-612
>                 URL:
>             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.

View raw message