summaryrefslogtreecommitdiffstats
path: root/deps/include/entt/meta/policy.hpp
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-03-15 16:22:09 +0500
committeruntodesu <kirill@untode.su>2025-03-15 16:22:09 +0500
commit3bf42c6ff3805a0d42bbc661794a95ff31bedc26 (patch)
tree05049955847504808d6bed2bb7b155f8b03807bb /deps/include/entt/meta/policy.hpp
parent02294547dcde0d4ad76e229106702261e9f10a51 (diff)
downloadvoxelius-3bf42c6ff3805a0d42bbc661794a95ff31bedc26.tar.bz2
voxelius-3bf42c6ff3805a0d42bbc661794a95ff31bedc26.zip
Add whatever I was working on for the last month
Diffstat (limited to 'deps/include/entt/meta/policy.hpp')
-rw-r--r--deps/include/entt/meta/policy.hpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/deps/include/entt/meta/policy.hpp b/deps/include/entt/meta/policy.hpp
new file mode 100644
index 0000000..2974b89
--- /dev/null
+++ b/deps/include/entt/meta/policy.hpp
@@ -0,0 +1,58 @@
+#ifndef ENTT_META_POLICY_HPP
+#define ENTT_META_POLICY_HPP
+
+#include <type_traits>
+
+namespace entt {
+
+/*! @brief Empty class type used to request the _as ref_ policy. */
+struct as_ref_t final {
+ /*! @cond TURN_OFF_DOXYGEN */
+ template<typename Type>
+ static constexpr bool value = std::is_reference_v<Type> && !std::is_const_v<std::remove_reference_t<Type>>;
+ /*! @endcond */
+};
+
+/*! @brief Empty class type used to request the _as cref_ policy. */
+struct as_cref_t final {
+ /*! @cond TURN_OFF_DOXYGEN */
+ template<typename Type>
+ static constexpr bool value = std::is_reference_v<Type>;
+ /*! @endcond */
+};
+
+/*! @brief Empty class type used to request the _as-is_ policy. */
+struct as_is_t final {
+ /*! @cond TURN_OFF_DOXYGEN */
+ template<typename>
+ static constexpr bool value = true;
+ /*! @endcond */
+};
+
+/*! @brief Empty class type used to request the _as void_ policy. */
+struct as_void_t final {
+ /*! @cond TURN_OFF_DOXYGEN */
+ template<typename>
+ static constexpr bool value = true;
+ /*! @endcond */
+};
+
+/**
+ * @brief Provides the member constant `value` to true if a type also is a meta
+ * policy, false otherwise.
+ * @tparam Type Type to check.
+ */
+template<typename Type>
+struct is_meta_policy
+ : std::bool_constant<std::is_same_v<Type, as_ref_t> || std::is_same_v<Type, as_cref_t> || std::is_same_v<Type, as_is_t> || std::is_same_v<Type, as_void_t>> {};
+
+/**
+ * @brief Helper variable template.
+ * @tparam Type Type to check.
+ */
+template<typename Type>
+inline constexpr bool is_meta_policy_v = is_meta_policy<Type>::value;
+
+} // namespace entt
+
+#endif