/// \file // CPP, the Concepts PreProcessor library // // Copyright Eric Niebler 2018-present // Copyright (c) 2020-present, Google LLC. // // Use, modification and distribution is subject to the // Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. // // Project home: https://github.com/ericniebler/range-v3 // #ifndef CPP_COMPARE_HPP #define CPP_COMPARE_HPP #if __cplusplus > 201703L && __has_include() && \ defined(__cpp_concepts) && defined(__cpp_impl_three_way_comparison) #include #include #include // clang-format off namespace concepts { // Note: concepts in this file can use C++20 concepts, since operator<=> isn't available in // compilers that don't support core concepts. namespace detail { template concept compares_as = same_as, Cat>; } // namespace detail inline namespace defs { template concept three_way_comparable = detail::weakly_equality_comparable_with_ && detail::partially_ordered_with_ && requires(detail::as_cref_t& a, detail::as_cref_t& b) { { a <=> b } -> detail::compares_as; }; template concept three_way_comparable_with = three_way_comparable && three_way_comparable && common_reference_with&, detail::as_cref_t&> && three_way_comparable&, detail::as_cref_t&>> && detail::partially_ordered_with_ && requires(detail::as_cref_t& t, detail::as_cref_t& u) { { t <=> u } -> detail::compares_as; { u <=> t } -> detail::compares_as; }; } // inline namespace defs } // namespace concepts // clang-format on #endif // __cplusplus #endif // CPP_COMPARE_HPP