/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2020, Danny Robson */ #pragma once #include "../concepts.hpp" #include #include #include namespace cruft::concepts { namespace detail { template struct is_ratio : public std::false_type {}; template struct is_ratio< std::ratio > : public std::true_type { }; }; template concept clock = numeric && detail::is_ratio::value && same_as> && //same_as> && same_as && requires (T t) { typename T::rep; typename T::period; typename T::time_point; typename T::duration; { T::is_steady } -> convertible_to; { t.now () } -> same_as; }; namespace detail { template concept trivial_clock_inner_type = equality_comparable && is_less_than_comparable_v && default_constructible && copy_constructible && copy_assignable && destructible && numeric && swappable; template concept trivial_clock = trivial_clock_inner_type && trivial_clock_inner_type && trivial_clock_inner_type && noexcept (std::declval ().now()); } template concept trivial_clock = detail::trivial_clock && detail::trivial_clock; }