summaryrefslogtreecommitdiffhomepage
path: root/compat/macros.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'compat/macros.hpp')
-rw-r--r--compat/macros.hpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/compat/macros.hpp b/compat/macros.hpp
index abe89c73..8b635201 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -51,9 +51,18 @@
# define PP_CAT1(x,y) x##y
#endif
+#define once_only(...) do { static bool once__ = false; if (!once__) { once__ = true; __VA_ARGS__; } } while(false)
+
#if defined __cplusplus
-// from now only C++ macros
+// from now only C++
+
+#include <type_traits>
+
+template<typename t>
+using cv_qualified = std::conditional_t<std::is_fundamental_v<std::decay_t<t>>,
+ std::decay_t<t>,
+ std::add_lvalue_reference_t<std::add_const_t<std::remove_reference_t<t>>>>;
template<bool>
[[deprecated]] constexpr force_inline void static_warn() {}
@@ -70,4 +79,3 @@ constexpr force_inline void static_warn<true>() {}
// end c++-only macros
#endif
-#define once_only(...) do { static bool once__ = false; if (!once__) { once__ = true; __VA_ARGS__; } } while(false)