diff --git a/include/date/ptz.h b/include/date/ptz.h index 78be1d2..fee4630 100644 --- a/include/date/ptz.h +++ b/include/date/ptz.h @@ -393,7 +393,7 @@ throw_invalid(const string_t& s, unsigned i, const string_t& message) { throw std::runtime_error(std::string("Invalid time_zone initializer.\n") + std::string(message) + ":\n" + - s + '\n' + + std::string(s) + '\n' + "\x1b[1;32m" + std::string(i, '~') + '^' + std::string(s.size()-i-1, '~') + diff --git a/include/date/tz.h b/include/date/tz.h index 69c1a58..686fdbf 100644 --- a/include/date/tz.h +++ b/include/date/tz.h @@ -474,30 +474,34 @@ public: >::type> zoned_time(std::string_view name, const local_time& tp, choose c); - template ::locate_zone(std::string_view())), - zoned_time - >::value - >::type> - zoned_time(std::string_view name, const zoned_time& zt); + < + std::is_convertible, + sys_time>::value && + std::is_constructible + < + zoned_time, + decltype(zoned_traits::locate_zone(std::string_view())), + zoned_time + >::value + >::type> + zoned_time(std::string_view name, const zoned_time& zt); - template ::locate_zone(std::string_view())), - zoned_time, - choose - >::value - >::type> - zoned_time(std::string_view name, const zoned_time& zt, choose); + < + std::is_convertible, + sys_time>::value && + std::is_constructible + < + zoned_time, + decltype(zoned_traits::locate_zone(std::string_view())), + zoned_time, + choose + >::value + >::type> + zoned_time(std::string_view name, const zoned_time& zt, choose); #else // !HAS_STRING_VIEW @@ -588,62 +592,80 @@ public: zoned_time(const char* name, const local_time& tp, choose c); #if !defined(_MSC_VER) || (_MSC_VER > 1900) - template ::locate_zone(std::string())), - zoned_time - >::value - >::type> + < + std::is_convertible, + sys_time>::value && + std::is_constructible + < + zoned_time, + decltype(zoned_traits::locate_zone(std::string())), + zoned_time + >::value + >::type> +#else + template #endif - zoned_time(const std::string& name, const zoned_time& zt); + zoned_time(const std::string& name, const zoned_time& zt); #if !defined(_MSC_VER) || (_MSC_VER > 1900) - template ::locate_zone(std::string())), - zoned_time - >::value - >::type> + < + std::is_convertible, + sys_time>::value && + std::is_constructible + < + zoned_time, + decltype(zoned_traits::locate_zone(std::string())), + zoned_time + >::value + >::type> +#else + template #endif - zoned_time(const char* name, const zoned_time& zt); + zoned_time(const char* name, const zoned_time& zt); #if !defined(_MSC_VER) || (_MSC_VER > 1900) - template ::locate_zone(std::string())), - zoned_time, - choose - >::value - >::type> + < + std::is_convertible, + sys_time>::value && + std::is_constructible + < + zoned_time, + decltype(zoned_traits::locate_zone(std::string())), + zoned_time, + choose + >::value + >::type> +#else + template #endif - zoned_time(const std::string& name, const zoned_time& zt, choose); + zoned_time(const std::string& name, const zoned_time& zt, + choose); #if !defined(_MSC_VER) || (_MSC_VER > 1900) - template ::locate_zone(std::string())), - zoned_time, - choose - >::value - >::type> + < + std::is_convertible, + sys_time>::value && + std::is_constructible + < + zoned_time, + decltype(zoned_traits::locate_zone(std::string())), + zoned_time, + choose + >::value + >::type> +#else + template #endif - zoned_time(const char* name, const zoned_time& zt, choose); + zoned_time(const char* name, const zoned_time& zt, + choose); #endif // !HAS_STRING_VIEW @@ -1465,17 +1487,19 @@ zoned_time::zoned_time(std::string_view name, {} template -template +template inline -zoned_time::zoned_time(std::string_view name, const zoned_time& zt) +zoned_time::zoned_time(std::string_view name, + const zoned_time& zt) : zoned_time(zoned_traits::locate_zone(name), zt) {} template -template +template inline zoned_time::zoned_time(std::string_view name, - const zoned_time& zt, choose c) + const zoned_time& zt, + choose c) : zoned_time(zoned_traits::locate_zone(name), zt, c) {} @@ -1543,40 +1567,51 @@ zoned_time::zoned_time(const char* name, template #if !defined(_MSC_VER) || (_MSC_VER > 1900) -template +template +#else +template #endif inline zoned_time::zoned_time(const std::string& name, - const zoned_time& zt) + const zoned_time& zt) : zoned_time(zoned_traits::locate_zone(name), zt) {} template #if !defined(_MSC_VER) || (_MSC_VER > 1900) -template +template +#else +template #endif inline -zoned_time::zoned_time(const char* name, const zoned_time& zt) +zoned_time::zoned_time(const char* name, + const zoned_time& zt) : zoned_time(zoned_traits::locate_zone(name), zt) {} template #if !defined(_MSC_VER) || (_MSC_VER > 1900) -template +template +#else +template #endif inline zoned_time::zoned_time(const std::string& name, - const zoned_time& zt, choose c) + const zoned_time& zt, + choose c) : zoned_time(zoned_traits::locate_zone(name), zt, c) {} template #if !defined(_MSC_VER) || (_MSC_VER > 1900) -template +template +#else +template #endif inline zoned_time::zoned_time(const char* name, - const zoned_time& zt, choose c) + const zoned_time& zt, + choose c) : zoned_time(zoned_traits::locate_zone(name), zt, c) {}