Add is_clock

This commit is contained in:
Howard Hinnant
2017-08-13 22:57:36 -04:00
parent eced00fc1c
commit be871e6c85

24
date.h
View File

@@ -106,6 +106,14 @@ namespace date
# define NOEXCEPT noexcept # define NOEXCEPT noexcept
#endif #endif
#ifndef HAS_VOID_T
# if __cplusplus >= 201703
# define HAS_VOID_T 1
# else
# define HAS_VOID_T 0
# endif
#endif // HAS_VOID_T
// Protect from Oracle sun macro // Protect from Oracle sun macro
#ifdef sun #ifdef sun
# undef sun # undef sun
@@ -893,6 +901,22 @@ CONSTCD11 date::year operator "" _y(unsigned long long y) NOEXCEPT;
} // inline namespace literals } // inline namespace literals
#endif // !defined(_MSC_VER) || (_MSC_VER >= 1900) #endif // !defined(_MSC_VER) || (_MSC_VER >= 1900)
#if HAS_VOID_T
template <class T, class = std::void_t<>>
struct is_clock
: std::false_type
{};
template <class T>
struct is_clock<T, std::void_t<decltype(T::now()), typename T::rep, typename T::period,
typename T::duration, typename T::time_point,
decltype(T::is_steady)>>
: std::true_type
{};
#endif // HAS_VOID_T
//----------------+ //----------------+
// Implementation | // Implementation |
//----------------+ //----------------+