<chrono>: Avoid unnecessary use of concepts
#1787
Merged
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.
Related to #1749 - we should avoid using concepts when
__cpp_lib_conceptsisn't defined.class = void_t<decltype(EXPRESSION)>for consistency (and shorter mangled names, although that doesn't really matter). This is still different than the most common form ofenable_if_t<CONDITION, int> = 0SFINAE which handles multiple overloads with the same signature, but that should be ok.<chrono>: Should divergence between ICU and IANA be reported? #1786.hh_mm_sscanstatic_assert_Is_duration_v.time_point:STL/stl/inc/chrono
Lines 198 to 206 in 6aed1a6
static_assert_Is_duration_vmessages now say "mandates".time_pointwas talking aboutstd::durationwhich isn't a thing! 😹clock_time_conversionConstraints/Mandates.SourceClock::to_sys(t)is well-formed." isn't concerned about the return type, only /2 "Mandates:SourceClock::to_sys(t)returns asys_time<Duration>" is.Durationis a validchrono::durationspecialization" is enforced bytime_pointitself (which we're going to instantiate while attempting to return it)._SourceClock2and_DestClock2as an extra layer of indirection because these template parameters belong to the struct instead of the function.clock_castmetaprogramming.clock_cast's function body), but not quite - we need to implement [time.clock.cast.fn]/1 "Constraints: At least one of the following clock time conversion expressions is well-formed" (which wasn't previously implemented as a constraint - instead it was astatic_assertwhich would be a Mandates), so the "choice" tech lets us reuse that work.