From 83f693de532f29d8f41bb350c404c905ef31a218 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Tue, 10 Oct 2023 02:24:18 -0400 Subject: [PATCH] Add a total-order shim header. Mathematical purism. --- TotalOrder.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 TotalOrder.h diff --git a/TotalOrder.h b/TotalOrder.h new file mode 100644 index 0000000..e18f722 --- /dev/null +++ b/TotalOrder.h @@ -0,0 +1,27 @@ +static_assert( __cplusplus > 2020'00 ); + +#pragma once + +#include + +#include "Concepts.h" + +namespace Alepha::inline Cavorite ::detail:: total_order +{ + inline namespace exports + { + using TotalOrder= std::strong_ordering; + + template< typename T > + concept TotalOrderable= + requires( const T &lhs, const T &rhs ) + { + { lhs <=> rhs } -> SameAs< TotalOrder >; + }; + } +} + +namespace Alepha::Cavorite::inline exports::inline total_order +{ + using namespace detail::total_order::exports; +}