Skip to content

LWG-3554 Add const charT* overloads for chrono::parse - #2261

Merged
Stephan T. Lavavej (StephanTLavavej) merged 6 commits into
microsoft:mainfrom
cpplearner:chrono-parse
Nov 3, 2021
Merged

LWG-3554 Add const charT* overloads for chrono::parse#2261
Stephan T. Lavavej (StephanTLavavej) merged 6 commits into
microsoft:mainfrom
cpplearner:chrono-parse

Conversation

@cpplearner

Copy link
Copy Markdown
Contributor

Implements LWG-3554 "chrono::parse needs const charT* and basic_string_view<charT> overloads" (despite the title, LWG-3554 does not add basic_string_view overloads).

Fixes #1928

@cpplearner
S. B. Tam (cpplearner) requested a review from a team as a code owner October 6, 2021 08:30
Comment thread stl/inc/chrono Outdated
@CaseyCarter Casey Carter (CaseyCarter) added the LWG Library Working Group issue label Oct 6, 2021
Comment thread tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp
Comment thread stl/inc/chrono
Comment thread stl/inc/chrono
};

template <class _CharT, class _Traits, class _Alloc, class _Parsable>
struct _Time_parse_iomanip {

@MattStephanson Matt Stephanson (MattStephanson) Oct 7, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a // TRANSITION, ABI comment to the effect that this can be replaced with _Time_parse_iomanip_c_str in the future?

Edit: this is showing more context than I intended. I was referring specifically to the struct _Time_parse_iomanip { line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The small code duplication is not bad enough to worry me, personally. Storing a reference to basic_string also has a tiny benefit, that is the format string is not invalidated if the basic_string is resized after the call to parse.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the manipulator is supposed to live long enought for the format string to be resized, but fair enough regarding the amount of code duplication.

Comment thread stl/inc/chrono Outdated
Comment thread stl/inc/chrono Outdated
Comment thread stl/inc/chrono Outdated
Co-authored-by: Casey Carter <cartec69@gmail.com>
Comment thread stl/inc/chrono Outdated
Comment thread stl/inc/chrono Outdated
Comment thread tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp Outdated
Comment thread tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp Outdated
@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 75d373a into microsoft:main Nov 3, 2021
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for implementing this LWG issue resolution in a timely manner! 😹 ⌚ 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chrono C++20 chrono LWG Library Working Group issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LWG-3554 chrono::parse needs const charT* and basic_string_view<charT> overloads

4 participants