From 591d03de95a737b418cdacd6d3ffa34f76545ad6 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 15 May 2023 20:26:29 +0300 Subject: [PATCH] BAN: add is_arithmetic and is_signed to Traits.h --- BAN/include/BAN/Traits.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BAN/include/BAN/Traits.h b/BAN/include/BAN/Traits.h index 0a9ca4f3b6..f9cef34356 100644 --- a/BAN/include/BAN/Traits.h +++ b/BAN/include/BAN/Traits.h @@ -65,6 +65,16 @@ namespace BAN template struct is_const : true_type {}; template inline constexpr bool is_const_v = is_const::value; + template struct is_arithmetic { static constexpr bool value = is_integral_v || is_floating_point_v; }; + template inline constexpr bool is_arithmetic_v = is_arithmetic::value; + + namespace detail + { + template> struct is_signed { static constexpr bool value = T(-1) < T(0); }; + template struct is_signed : false_type {}; + } + template struct is_signed : detail::is_signed {}; + template inline constexpr bool is_signed_v = is_signed::value; template struct less { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; } }; template struct equal { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; } };