Open Charles-lgc opened 2 years ago
You can modify the format string to match a wide variety of white space characters:
These can be combined to match even more patterns. For example "%n " matches one or more white space charcters, and "%n%t%t" matches one to three white space characters.
Thank you Howard, but I'm talking about the convention:
For standard streams, the
skipws
flag is set on initialization.
So the behavior of is>>date(parse)
might be not consistent with this default standard assumption (i.e. skipws
is set by default).
parse
is a manipulator for calling from_stream
. from_stream
is documented to be consistent with other unformatted input functions (e.g. getline
). The rationale for choosing this behavior is because the formatting is supplied by the fmt string argument which provides better whitespace control than do the formatted input functions (which have no way to control whitespace in the input other than skipws
).
This behavior is now part of C++20, and efforts to change it have to be directed to the C++ Standards Committee (WG21). The "date" library now serves as a preview of this part of C++20 for those clients who can not yet migrate to C++20. Therefore to the extent practical, the date lib will follow the C++20 specification (though there are deviations made for practical reasons).
(v3.0.1)
This will fail to extract time from the stream. Maybe it is more consistent with the current behavior of
operator>>(istream, v)
to makedate::parse
skip "space" chars automatically?