This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: another effc++ spurious warning?


You Wrote Giovanni Bajo
> Gabriel Dos Reis wrote:
>
>>> I don't see anything in the standard which says that, for Input/Output
>>> iterators, operator++(int) should return a reference (possibly to
>>> this).
>
>> Good!  Then, why do you insist that you should warn about what they
>> return, and expecially that [io]stream_iterator<> are
>> special cases then?
>
> Please, show me how to implement a well-formed operator++(int) which
> returns a
> reference, for *any* kind of iterator.

so for you an an ostream_iterator<> is not well-formed?
If not, why are you asking the question?

The standard requirement on an output iterator is that

    r++

is convertible to a const X&.  Now you're claiming that
any iterator that meets that requirements by returning a reference
is ill-formed?  You must be jocking.

> If you can show me that Input/Output iterators (besides the standard ones)
> are
> *forced* to define an operator++(int) which returns by reference, I will
> drop
> this.

That sentecne is silly.

This is exactly the taliban view championed by -Weffc++ that
I would like to see lowered.

You're not forced to use C++.  Your're not forced to use
abstractions, you're not foced to use iterators.
So do you me want to show you why you would be forced to
to return by reference?

An output iterator that models states in a DAG can sanely
use pointer identify

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]