Title
ostream_iterator does not work with movable types
Status
nad
Section
[ostream.iterator.ops]
Submitter
Alisdair Meredith

Created on 2009-05-28.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

Several objections to move forward with this issue were voiced in the thread starting with c++std-lib-25438. Among them is that we know of no motivating use case to make streaming rvalues behave differently than streaming const lvalues.

Date: 2010-10-21.18:28:33

Proposed resolution:

Add second operator= overload to class template ostream_iterator in [ostream.iterator], para 2:

ostream_iterator<T,charT,traits>& operator=(const T& value);
ostream_iterator<T,charT,traits>& operator=(T&& value);

Add a new paragraph: in [ostream.iterator.ops]:

ostream_iterator& operator=(T&& value);

-2- Effects:

*out_stream << std::move(value);
if(delim != 0)
  *out_stream << delim;
return (*this);
Date: 2009-11-10.00:00:00

[ 2009-11-10 Howard adds: ]

Moved to Tentatively NAD after 5 positive votes on c++std-lib. Rationale added below.

Date: 2009-05-28.00:00:00

ostream_iterator has not been updated to support moveable types, in a similar manner to the insert iterators. Note that this is not a problem for ostreambuf_iterator, as the types it is restricted to dealing with do not support extra-efficient moving.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg835
2010-10-21 18:28:33adminsetmessages: + msg834
2010-10-21 18:28:33adminsetmessages: + msg833
2009-05-28 00:00:00admincreate