From 9b8e6e6629e68ec3da5dff01ce856fcc72f0f52b Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 24 Dec 2023 13:36:12 +0200 Subject: [PATCH] BAN: Implement is_*constructable --- BAN/include/BAN/Traits.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/BAN/include/BAN/Traits.h b/BAN/include/BAN/Traits.h index 1db6ca6f..b85b7073 100644 --- a/BAN/include/BAN/Traits.h +++ b/BAN/include/BAN/Traits.h @@ -46,6 +46,18 @@ namespace BAN template inline constexpr bool is_lvalue_reference_v = is_lvalue_reference::value; template concept lvalue_reference = is_lvalue_reference_v; + template struct is_constructible { static constexpr bool value = __is_constructible(T, Args...); }; + template inline constexpr bool is_constructible_v = is_constructible::value; + + template struct is_default_constructible { static constexpr bool value = is_constructible_v; }; + template inline constexpr bool is_default_constructible_v = is_default_constructible::value; + + template struct is_copy_constructible { static constexpr bool value = is_constructible_v; }; + template inline constexpr bool is_copy_constructible_v = is_copy_constructible::value; + + template struct is_move_constructible { static constexpr bool value = is_constructible_v; }; + template inline constexpr bool is_move_constructible_v = is_move_constructible::value; + template struct is_integral { static constexpr bool value = requires (T t, T* p, void (*f)(T)) { reinterpret_cast(t); f(0); p + t; }; }; template inline constexpr bool is_integral_v = is_integral::value; template concept integral = is_integral_v;