Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions stl/inc/__msvc_chrono.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,32 @@ namespace chrono {
}
};

_EXPORT_STD template <class _Rep, class _Period = ratio<1>>
class duration;

_EXPORT_STD template <class _Clock, class _Duration = typename _Clock::duration>
class time_point;

#if _HAS_CXX20
_EXPORT_STD template <class _Clock>
_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool is_clock_v = requires {
// Basic checks from N5014 [time.traits.is.clock]/1
typename _Clock::rep;
typename _Clock::period;
typename _Clock::duration;
typename _Clock::time_point;
_Clock::is_steady;
_Clock::now();

// Additional stricter checks from N5014 [time.clock.req]/2
// "An arithmetic type or a class emulating an arithmetic type" is not checked
requires _Is_ratio_v<typename _Clock::period>;
requires same_as<typename _Clock::duration, duration<typename _Clock::rep, typename _Clock::period>>;
requires same_as<typename _Clock::time_point, time_point<_Clock>>
|| same_as<typename _Clock::time_point,
time_point<typename _Clock::time_point::clock, typename _Clock::duration>>;
{ _Clock::is_steady } -> std::same_as<const bool&>;
{ _Clock::now() } -> std::same_as<typename _Clock::time_point>;
};
_EXPORT_STD template <class _Clock>
struct _NO_SPECIALIZATIONS_CITING("N5014 [time.traits.is.clock]/2") is_clock : bool_constant<is_clock_v<_Clock>> {};
Expand All @@ -84,9 +101,6 @@ namespace chrono {
true;
#endif // ^^^ !_HAS_CXX20 ^^^

_EXPORT_STD template <class _Rep, class _Period = ratio<1>>
class duration;

template <class _Ty>
constexpr bool _Is_duration_v = _Is_specialization_v<_Ty, duration>;

Expand Down Expand Up @@ -203,7 +217,7 @@ namespace chrono {
_Rep _MyRep; // the stored rep
};

_EXPORT_STD template <class _Clock, class _Duration = typename _Clock::duration>
_EXPORT_STD template <class _Clock, class _Duration>
class time_point { // represents a point in time
public:
using clock = _Clock;
Expand Down
Loading