Reversed order of arguments to clock_time_conversion.

Now the order of argument matches the clock_cast function.
The test only is_clock_castable trait still matches is_convertible
order of arguments.
This commit is contained in:
Tomasz Kamiński 2017-11-25 22:14:51 +01:00 committed by Howard Hinnant
parent 7c69f1570d
commit 543315b700
8 changed files with 51 additions and 51 deletions

View File

@ -2197,7 +2197,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
return is; return is;
} }
template<typename SourceClock, typename DestClock> template<typename DestClock, typename SourceClock>
struct clock_time_conversion struct clock_time_conversion
{}; {};
@ -2224,7 +2224,7 @@ struct clock_time_conversion<utc_clock, utc_clock>
}; };
template<> template<>
struct clock_time_conversion<std::chrono::system_clock, utc_clock> struct clock_time_conversion<utc_clock, std::chrono::system_clock>
{ {
template <class Duration> template <class Duration>
utc_time<typename std::common_type<Duration, std::chrono::seconds>::type> utc_time<typename std::common_type<Duration, std::chrono::seconds>::type>
@ -2235,7 +2235,7 @@ struct clock_time_conversion<std::chrono::system_clock, utc_clock>
}; };
template<> template<>
struct clock_time_conversion<utc_clock, std::chrono::system_clock> struct clock_time_conversion<std::chrono::system_clock, utc_clock>
{ {
template <class Duration> template <class Duration>
sys_time<typename std::common_type<Duration, std::chrono::seconds>::type> sys_time<typename std::common_type<Duration, std::chrono::seconds>::type>
@ -2311,7 +2311,7 @@ namespace ctc_detail
} }
template<typename SourceClock> template<typename SourceClock>
struct clock_time_conversion<SourceClock, std::chrono::system_clock> struct clock_time_conversion<std::chrono::system_clock, SourceClock>
{ {
template <class Duration> template <class Duration>
auto operator()(const std::chrono::time_point<SourceClock, Duration>& tp) const auto operator()(const std::chrono::time_point<SourceClock, Duration>& tp) const
@ -2322,7 +2322,7 @@ struct clock_time_conversion<SourceClock, std::chrono::system_clock>
}; };
template<typename DestClock> template<typename DestClock>
struct clock_time_conversion<std::chrono::system_clock, DestClock> struct clock_time_conversion<DestClock, std::chrono::system_clock>
{ {
template <class Duration> template <class Duration>
auto operator()(const sys_time<Duration>& st) const auto operator()(const sys_time<Duration>& st) const
@ -2333,7 +2333,7 @@ struct clock_time_conversion<std::chrono::system_clock, DestClock>
}; };
template<typename SourceClock> template<typename SourceClock>
struct clock_time_conversion<SourceClock, utc_clock> struct clock_time_conversion<utc_clock, SourceClock>
{ {
template <class Duration> template <class Duration>
auto operator()(const std::chrono::time_point<SourceClock, Duration>& tp) const auto operator()(const std::chrono::time_point<SourceClock, Duration>& tp) const
@ -2344,7 +2344,7 @@ struct clock_time_conversion<SourceClock, utc_clock>
}; };
template<typename DestClock> template<typename DestClock>
struct clock_time_conversion<utc_clock, DestClock> struct clock_time_conversion<DestClock, utc_clock>
{ {
template <class Duration> template <class Duration>
auto operator()(const utc_time<Duration>& ut) const auto operator()(const utc_time<Duration>& ut) const
@ -2358,9 +2358,9 @@ namespace clock_cast_detail
{ {
template<typename DestClock, typename SourceClock, typename Duration> template<typename DestClock, typename SourceClock, typename Duration>
auto conv_clock(const std::chrono::time_point<SourceClock, Duration>& st) auto conv_clock(const std::chrono::time_point<SourceClock, Duration>& st)
-> decltype(std::declval<clock_time_conversion<SourceClock, DestClock>>()(st)) -> decltype(std::declval<clock_time_conversion<DestClock, SourceClock>>()(st))
{ {
return clock_time_conversion<SourceClock, DestClock>{}(st); return clock_time_conversion<DestClock, SourceClock>{}(st);
} }
//direct triat conversion, 2nd candidate //direct triat conversion, 2nd candidate

View File

@ -100,7 +100,7 @@ struct s2s_clock
namespace date namespace date
{ {
template<> template<>
struct clock_time_conversion<s2s_clock, mil_clock> struct clock_time_conversion<mil_clock, s2s_clock>
{ {
template<typename Duration> template<typename Duration>
std::chrono::time_point<mil_clock, std::common_type_t<Duration, date::days>> std::chrono::time_point<mil_clock, std::common_type_t<Duration, date::days>>

View File

@ -54,7 +54,7 @@ struct steady_based_clock
namespace date namespace date
{ {
template<> template<>
struct clock_time_conversion<steady_based_clock, std::chrono::steady_clock> struct clock_time_conversion<std::chrono::steady_clock, steady_based_clock>
{ {
template<typename Duration> template<typename Duration>
std::chrono::time_point<std::chrono::steady_clock, Duration> std::chrono::time_point<std::chrono::steady_clock, Duration>
@ -66,7 +66,7 @@ namespace date
}; };
template<> template<>
struct clock_time_conversion<std::chrono::steady_clock, steady_based_clock> struct clock_time_conversion<steady_based_clock, std::chrono::steady_clock>
{ {
template<typename Duration> template<typename Duration>
std::chrono::time_point<steady_based_clock, Duration> std::chrono::time_point<steady_based_clock, Duration>
@ -174,7 +174,7 @@ namespace date
{ {
//Disambiguates that sys_clock is preffered //Disambiguates that sys_clock is preffered
template<> template<>
struct clock_time_conversion<amb2_clock, amb1_clock> struct clock_time_conversion<amb1_clock, amb2_clock>
{ {
template<typename Duration> template<typename Duration>
std::chrono::time_point<amb1_clock, Duration> std::chrono::time_point<amb1_clock, Duration>