summaryrefslogtreecommitdiff
path: root/asl/meta.hpp
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2024-08-23 20:05:22 +0200
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2024-08-23 20:05:22 +0200
commit19ce24de5e8ef31be2925074e962ae23aaf65be0 (patch)
tree08bb129f79ced8efe3f6f4002b0750395adb7f21 /asl/meta.hpp
parentea795dcccb136a45fa08a8a82953f95343706c6c (diff)
Some work on ptr
Diffstat (limited to 'asl/meta.hpp')
-rw-r--r--asl/meta.hpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/asl/meta.hpp b/asl/meta.hpp
index b3e0697..411d890 100644
--- a/asl/meta.hpp
+++ b/asl/meta.hpp
@@ -2,6 +2,10 @@
namespace asl {
+template<typename... Args> struct types {};
+
+struct empty {};
+
template<typename T> struct id { using type = T; };
template<typename T, T kValue> struct integral_constant { static constexpr T value = kValue; };
@@ -29,6 +33,12 @@ template<typename T> auto _as_rref_helper(...) -> id<T>;
template<typename T> using as_lref_t = decltype(_as_lref_helper<T>(0))::type;
template<typename T> using as_rref_t = decltype(_as_rref_helper<T>(0))::type;
+template<typename T> struct _un_ref_t { using type = T; };
+template<typename T> struct _un_ref_t<T&> { using type = T; };
+template<typename T> struct _un_ref_t<T&&> { using type = T; };
+
+template<typename T> using un_ref_t = _un_ref_t<T>::type;
+
template<typename T, typename... Args> concept constructible = __is_constructible(T, Args...);
template<typename T> concept default_constructible = constructible<T>;
@@ -123,4 +133,13 @@ template<typename T, int N> struct _is_array_helper<T[N]> : true_type {};
template<typename T> concept is_array = _is_array_helper<T>::value;
+template<typename T>
+auto _devoid_helper()
+{
+ if constexpr (is_void<T>) return id<empty>{};
+ else return id<T>{};
+}
+
+template<typename T> using devoid_t = decltype(_devoid_helper<T>())::type;
+
} // namespace asl