This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: reference type of output_iterator_wrapper
On Tue, Apr 18, 2006 at 10:08:15AM -0400, Douglas Gregor wrote:
>
> On Apr 17, 2006, at 3:59 PM, Howard Hinnant wrote:
> >Fwiw I suggested the standard do something like this in Berlin and
> >got met with pretty strong opposition (give a non-void
> >iterator_traits to output iterators).
>
> I obviously missed that part of the discussion.
>
> >The standard currently says that value_type and difference_type
> >should be void for output iterators (24.3.1/1). I think it's a bad
> >rule, and apparently I'm not alone. But there's an up hill battle
> >in the LWG here. Packaging it with concepts might help.
>
> Well, the right thing to do with value_type and difference_type for
> output iterators is to say nothing at all about them. void is
> blatantly wrong, because:
>
> - if it's an output iterator, difference_type must be void
> - if it's a forward iterator, difference_type must be a signed
> integral type
> - every forward iterator is an output iterator
> - but void isn't a signed integral type
I assume, then, that this is bad wording and is meant to apply only to
output iterators that are not also forward iterators. That is, it's
supposed to be a way to make templates that expect forward iterators
fail cleanly on output iterators. Otherwise, as you say, there are
conflicting requirements.