Browse Source

any: avoid duplicating operation/policy for all specializations

Michele Caini 3 years ago
parent
commit
54dd716d02
1 changed files with 32 additions and 15 deletions
  1. 32 15
      src/entt/core/any.hpp

+ 32 - 15
src/entt/core/any.hpp

@@ -13,6 +13,36 @@
 
 namespace entt {
 
+/**
+ * @cond TURN_OFF_DOXYGEN
+ * Internal details not to be documented.
+ */
+
+namespace internal {
+
+enum class any_operation : std::uint8_t {
+    copy,
+    move,
+    transfer,
+    assign,
+    destroy,
+    compare,
+    get
+};
+
+enum class any_policy : std::uint8_t {
+    owner,
+    ref,
+    cref
+};
+
+} // namespace internal
+
+/**
+ * Internal details not to be documented.
+ * @endcond
+ */
+
 /**
  * @brief A SBO friendly, type-safe container for single values of any type.
  * @tparam Len Size of the storage reserved for the small buffer optimization.
@@ -20,21 +50,8 @@ namespace entt {
  */
 template<std::size_t Len, std::size_t Align>
 class basic_any {
-    enum class operation : std::uint8_t {
-        copy,
-        move,
-        transfer,
-        assign,
-        destroy,
-        compare,
-        get
-    };
-
-    enum class policy : std::uint8_t {
-        owner,
-        ref,
-        cref
-    };
+    using operation = internal::any_operation;
+    using policy = internal::any_policy;
 
     using storage_type = std::aligned_storage_t<Len + !Len, Align>;
     using vtable_type = const void *(const operation, const basic_any &, const void *);