This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.
Section: 25.6.3.3 [ostream.iterator.ops] Status: NAD Submitter: Alisdair Meredith Opened: 2009-05-28 Last modified: 2016-01-28
Priority: Not Prioritized
View all issues with NAD status.
Discussion:
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.
[ 2009-11-10 Howard adds: ]
Moved to Tentatively NAD after 5 positive votes on c++std-lib. Rationale added below.
Proposed resolution:
Add second operator= overload to class template ostream_iterator in 25.6.3 [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 25.6.3.3 [ostream.iterator.ops]:
ostream_iterator& operator=(T&& value);-2- Effects:
*out_stream << std::move(value); if(delim != 0) *out_stream << delim; return (*this);
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.