Debian Codegraph @

3rd_party/range-v3/range/v3/compare.hpp

raw
1 /// \file
2 // CPP, the Concepts PreProcessor library
3 //
4 // Copyright Eric Niebler 2018-present
5 // Copyright (c) 2020-present, Google LLC.
6 //
7 // Use, modification and distribution is subject to the
8 // Boost Software License, Version 1.0. (See accompanying
9 // file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11 //
12 // This source code is licensed under the MIT license found in the
13 // LICENSE file in the root directory of this source tree.
14 //
15 // Project home: https://github.com/ericniebler/range-v3
16 //
17 #ifndef RANGES_V3_COMPARE_HPP
18 #define RANGES_V3_COMPARE_HPP
19
20 #if __cplusplus > 201703L && __has_include(<compare>) && \
21 defined(__cpp_concepts) && defined(__cpp_impl_three_way_comparison)
22
23 #include <compare>
24 #include <type_traits>
25
26 namespace ranges
27 {
28 template<typename... Ts>
29 struct common_comparison_category
30 {
31 using type = void;
32 };
33
34 template<typename... Ts>
35 requires ((std::is_same_v<Ts, std::partial_ordering> ||
36 std::is_same_v<Ts, std::weak_ordering> ||
37 std::is_same_v<Ts, std::strong_ordering>) && ...)
38 struct common_comparison_category<Ts...> : std::common_type<Ts...>
39 {};
40
41 template<typename... Ts>
42 using common_comparison_category_t = typename common_comparison_category<Ts...>::type;
43 } // namespace ranges
44
45 #endif // __cplusplus
46 #endif // RANGES_V3_COMPARE_HPP