From 5df48804e1bd0d4a074670d06a277367081bef47 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 12 Jul 2023 13:34:31 +0300 Subject: [PATCH] BAN: add either_or and either_or_t This allows you to select type depending on constexpr evaluatable boolean --- BAN/include/BAN/Traits.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BAN/include/BAN/Traits.h b/BAN/include/BAN/Traits.h index f9cef343..dd59de0c 100644 --- a/BAN/include/BAN/Traits.h +++ b/BAN/include/BAN/Traits.h @@ -30,6 +30,10 @@ namespace BAN template struct maybe_const { using type = const T; }; template using maybe_const_t = typename maybe_const::type; + template struct either_or { using type = T2; }; + template struct either_or { using type = T1; }; + template using either_or_t = typename either_or::type; + struct true_type { static constexpr bool value = true; }; struct false_type { static constexpr bool value = false; };