Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why value_type for ostream_iterator is void? #721

Closed
tshev opened this issue May 7, 2016 · 2 comments
Closed

Why value_type for ostream_iterator is void? #721

tshev opened this issue May 7, 2016 · 2 comments

Comments

@tshev
Copy link

tshev commented May 7, 2016

No description provided.

@AlisdairM
Copy link
Contributor

It is a common convention for all output iterators (that are not also input iterators) to have 'void' for all their typedefs other than the iterator category. If you think there is an issue here, it should be filed with the Library Working Group chair, as it is distinctly more than editorial - but I think the standard is exactly as intended here.

@jwakely
Copy link
Member

jwakely commented May 10, 2016

The only value operation to perform when dereferencing an iterator with category output_iterator is to assign to it, so a void value type discourages people from trying to do:

iterator_traits<ostream_iterator<int>>::value_type = *ostr_iter;

Of course with auto you don't need to know the value type, but that doesn't mean that a non-void value type would be useful.

As Alisdair says, this is not an editorial issue, so does not belong here.

@jwakely jwakely closed this as completed May 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants