compare.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #if __cplusplus > 201703L && __has_include(<compare>) && \
  18. defined(__cpp_concepts) && defined(__cpp_impl_three_way_comparison)
  19. #include <compare>
  20. #include <range/v3/compare.hpp>
  21. #include <range/v3/range_fwd.hpp>
  22. using ranges::same_as;
  23. using ranges::common_comparison_category_t;
  24. static_assert(same_as<common_comparison_category_t<std::partial_ordering>, std::partial_ordering>);
  25. static_assert(same_as<common_comparison_category_t<std::weak_ordering>, std::weak_ordering>);
  26. static_assert(same_as<common_comparison_category_t<std::strong_ordering>, std::strong_ordering>);
  27. static_assert(same_as<common_comparison_category_t<std::partial_ordering, std::strong_ordering>, std::partial_ordering>);
  28. static_assert(same_as<common_comparison_category_t<std::weak_ordering, std::strong_ordering>, std::weak_ordering>);
  29. static_assert(same_as<common_comparison_category_t<std::strong_ordering, std::strong_ordering>, std::strong_ordering>);
  30. static_assert(same_as<common_comparison_category_t<std::weak_ordering, std::strong_ordering, std::partial_ordering>, std::partial_ordering>);
  31. static_assert(same_as<common_comparison_category_t<ranges::less, std::partial_ordering>, void>);
  32. static_assert(same_as<common_comparison_category_t<ranges::less*, std::strong_ordering>, void>);
  33. static_assert(same_as<common_comparison_category_t<ranges::less&, std::strong_ordering, std::partial_ordering>, void>);
  34. static_assert(same_as<common_comparison_category_t<ranges::less(*)(), std::strong_ordering, std::partial_ordering>, void>);
  35. #endif // __cplusplus
  36. int main() {}