<chrono>: Formatting cleanups#1842
Merged
StephanTLavavej merged 1 commit intomicrosoft:chronat2from Apr 16, 2021
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
<chrono><sstream>unconditionally, but it's needed for C++20 only.<iomanip>forput_time()in concepts mode only.<iostream>(which provides the standard iostream objectscoutetc.). Our implementation of<sstream>already drags in<istream>and<ostream>._Is_hh_mm_ss; we can use_Is_specialization_v._Choose_literal(); now that we haveif constexpr, we don't need thestructlayer._NODISCARD, top-levelconst,noexcept._Auto_id_tag, there's no need forconst._Chrono_specs_setter::_Specscan beprivate; we haven't needed derived classes yet._Parse_chrono_format_specs(), we alwaysreturnwhen_Begin == _End(i.e. at the beginning of the function, and whenever updating_Begin). Therefore, we don't need to check_Begin != _Endwhen verifying that the chrono-specs begin with a conversion-spec._Next_chno longer has a purpose (and has a slightly confusing name now). We can simplyswitchon*_Begin._STDqualification toformat()calls.static constexpr(no functional difference)._Chrono_formatter::_Writejust needs abasic_ostringstream, instead of a generalbasic_stringstream./* strengthened */rewrapping that had diverged frommain.#undef _STATICALLY_WIDENat the end of<chrono>, to avoid temptation.P0355R7_calendars_and_time_zones_formatting/test.cpp<sstream>.stream_helper()just needs abasic_ostringstream.print()as temporary, as it's unused.