tomaszkam / date

A date and time library based on the C++11/14/17 <chrono> header
Other
0 stars 0 forks source link

[P1361] Specify result of attempt to stream missing information #5

Closed tomaszkam closed 5 years ago

tomaszkam commented 5 years ago

Original comment:

remove the "may stream an unspecified value” part. If a flag is used which requests information that the Streamable does not have, or if the Streamable or a subset of it which the flag needs is !ok(), failbit is set.

Email conversation (reflector): [isocpp-lib] Which to_stream format specifiers set failbit instead of stream an unspecified value?

tomaszkam commented 5 years ago

Tim's comments:

Note that with this change, a number of operator<<'s currently specified to (unconditionally) call format need to be adjusted because setting failbit will cause an exception but << is meant to accept !ok() things.

tomaszkam commented 5 years ago

@HowardHinnant, @timsong-cpp: This seems to be fully addressed by changes done in P1361, where format function will throw format_error in case of missing information, and all operator<< will not throw errors at all, so ios.faibit will never be set.