insert_iterator
and ostreambuf_iterator
don't properly support *o++ = t;
#302
Labels
insert_iterator
and ostreambuf_iterator
don't properly support *o++ = t;
#302
See the discussion at CaseyCarter/cmcstl2#60 (comment). Both iterators internally store state that must be updated on each write. We made a blanket change to have output iterators'
operator++(int)
return a copy instead of a reference after the discussion in #137 (and IIRC discussion with LWG at Kona) we brokeinsert_iterator
andostreambuf_iterator
. The expression*o++ = t
results in updating the state of the temporary immediately before throwing it on the floor. Later use of the iterator sees the "old" state and does terrible things.The fix is to change the postfix increment of at least
insert_iterator
andostreambuf_iterator
, if not all of the output iterators specified in the TS, to again return by reference as in Standard C++.Proposed Resolution
Adopt P0541.
The text was updated successfully, but these errors were encountered: