Przeglądaj źródła

stl: std::bool_constant

skypjack 19 godzin temu
rodzic
commit
8f411924b4

+ 1 - 1
src/entt/container/table.hpp

@@ -424,7 +424,7 @@ namespace std {
 
 template<typename... Container, typename Allocator>
 struct uses_allocator<entt::basic_table<Container...>, Allocator>
-    : std::bool_constant<(std::uses_allocator_v<Container, Allocator> && ...)> {};
+    : entt::stl::bool_constant<(std::uses_allocator_v<Container, Allocator> && ...)> {};
 
 } // namespace std
 /*! @endcond */

+ 1 - 1
src/entt/core/any.hpp

@@ -45,7 +45,7 @@ struct basic_any_storage<0u, Align> {
 
 template<typename Type, std::size_t Len, std::size_t Align>
 // NOLINTNEXTLINE(bugprone-sizeof-expression)
-struct in_situ: std::bool_constant<(Len != 0u) && alignof(Type) <= Align && sizeof(Type) <= Len && stl::is_nothrow_move_constructible_v<Type>> {};
+struct in_situ: stl::bool_constant<(Len != 0u) && alignof(Type) <= Align && sizeof(Type) <= Len && stl::is_nothrow_move_constructible_v<Type>> {};
 
 template<std::size_t Len, std::size_t Align>
 struct in_situ<void, Len, Align>: stl::false_type {};

+ 4 - 4
src/entt/core/type_traits.hpp

@@ -283,7 +283,7 @@ struct type_list_contains;
  */
 template<typename... Type, typename Other>
 struct type_list_contains<type_list<Type...>, Other>
-    : std::bool_constant<(stl::is_same_v<Type, Other> || ...)> {};
+    : stl::bool_constant<(stl::is_same_v<Type, Other> || ...)> {};
 
 /**
  * @brief Helper variable template.
@@ -545,7 +545,7 @@ struct value_list_contains;
  */
 template<auto... Value, auto Other>
 struct value_list_contains<value_list<Value...>, Other>
-    : std::bool_constant<((Value == Other) || ...)> {};
+    : stl::bool_constant<((Value == Other) || ...)> {};
 
 /**
  * @brief Helper variable template.
@@ -690,7 +690,7 @@ inline constexpr bool is_iterator_v = is_iterator<Type>::value;
  * @tparam Type The type to test
  */
 template<typename Type>
-struct is_ebco_eligible: std::bool_constant<std::is_empty_v<Type> && !std::is_final_v<Type>> {};
+struct is_ebco_eligible: stl::bool_constant<std::is_empty_v<Type> && !std::is_final_v<Type>> {};
 
 /**
  * @brief Helper variable template.
@@ -786,7 +786,7 @@ template<typename Type>
  * @tparam Type The type to test.
  */
 template<typename Type>
-struct is_equality_comparable: std::bool_constant<internal::dispatch_is_equality_comparable<Type>()> {};
+struct is_equality_comparable: stl::bool_constant<internal::dispatch_is_equality_comparable<Type>()> {};
 
 /*! @copydoc is_equality_comparable */
 template<typename Type>

+ 1 - 1
src/entt/entity/component.hpp

@@ -14,7 +14,7 @@ namespace entt {
 namespace internal {
 
 template<typename Type>
-struct in_place_delete: std::bool_constant<!(std::is_move_constructible_v<Type> && stl::is_move_assignable_v<Type>)> {};
+struct in_place_delete: stl::bool_constant<!(std::is_move_constructible_v<Type> && stl::is_move_assignable_v<Type>)> {};
 
 template<>
 struct in_place_delete<void>: stl::false_type {};

+ 4 - 4
src/entt/meta/container.hpp

@@ -236,8 +236,8 @@ struct basic_meta_associative_container_traits {
      */
     static iterator iter(const meta_ctx &area, void *container, const void *as_const, const bool end) {
         return (container == nullptr)
-                   ? iterator{area, std::bool_constant<key_only>{}, end ? static_cast<const Type *>(as_const)->cend() : static_cast<const Type *>(as_const)->cbegin()}
-                   : iterator{area, std::bool_constant<key_only>{}, end ? static_cast<Type *>(container)->end() : static_cast<Type *>(container)->begin()};
+                   ? iterator{area, stl::bool_constant<key_only>{}, end ? static_cast<const Type *>(as_const)->cend() : static_cast<const Type *>(as_const)->cbegin()}
+                   : iterator{area, stl::bool_constant<key_only>{}, end ? static_cast<Type *>(container)->end() : static_cast<Type *>(container)->begin()};
     }
 
     /**
@@ -274,8 +274,8 @@ struct basic_meta_associative_container_traits {
      * @return An iterator to the element with the given key, if any.
      */
     static iterator find(const meta_ctx &area, void *container, const void *as_const, const void *key) {
-        return (container != nullptr) ? iterator{area, std::bool_constant<key_only>{}, static_cast<Type *>(container)->find(*static_cast<const Type::key_type *>(key))}
-                                      : iterator{area, std::bool_constant<key_only>{}, static_cast<const Type *>(as_const)->find(*static_cast<const Type::key_type *>(key))};
+        return (container != nullptr) ? iterator{area, stl::bool_constant<key_only>{}, static_cast<Type *>(container)->find(*static_cast<const Type::key_type *>(key))}
+                                      : iterator{area, stl::bool_constant<key_only>{}, static_cast<const Type *>(as_const)->find(*static_cast<const Type::key_type *>(key))};
     }
 };
 

+ 1 - 1
src/entt/meta/meta.hpp

@@ -1715,7 +1715,7 @@ public:
     meta_iterator() = default;
 
     template<bool KeyOnly, stl::forward_iterator It>
-    meta_iterator(const meta_ctx &area, std::bool_constant<KeyOnly>, It iter) noexcept
+    meta_iterator(const meta_ctx &area, stl::bool_constant<KeyOnly>, It iter) noexcept
         : ctx{&area},
           vtable{&basic_vtable<KeyOnly, It>},
           handle{iter} {}

+ 1 - 1
src/entt/meta/policy.hpp

@@ -60,7 +60,7 @@ struct as_is_t final: private internal::meta_policy {
  */
 template<typename Type>
 struct is_meta_policy
-    : std::bool_constant<std::is_base_of_v<internal::meta_policy, Type>> {};
+    : stl::bool_constant<std::is_base_of_v<internal::meta_policy, Type>> {};
 
 /**
  * @brief Helper variable template.

+ 1 - 0
src/entt/stl/type_traits.hpp

@@ -6,6 +6,7 @@
 /*! @cond ENTT_INTERNAL */
 namespace entt::stl {
 
+using std::bool_constant;
 using std::decay_t;
 using std::false_type;
 using std::invoke_result_t;