Просмотр исходного кода

stl: std::is_default_constructible_v

skypjack 19 часов назад
Родитель
Сommit
573d982c1c

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

@@ -151,7 +151,7 @@ class basic_any: private internal::basic_any_storage<Len, Align> {
 
             mode = any_policy::embedded;
 
-            if constexpr(stl::is_aggregate_v<plain_type> && (sizeof...(Args) != 0u || !std::is_default_constructible_v<plain_type>)) {
+            if constexpr(stl::is_aggregate_v<plain_type> && (sizeof...(Args) != 0u || !stl::is_default_constructible_v<plain_type>)) {
                 ::new(&this->buffer) plain_type{stl::forward<Args>(args)...};
             } else {
                 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
@@ -161,7 +161,7 @@ class basic_any: private internal::basic_any_storage<Len, Align> {
             deleter = &basic_deleter<plain_type>;
             mode = any_policy::dynamic;
 
-            if constexpr(stl::is_aggregate_v<plain_type> && (sizeof...(Args) != 0u || !std::is_default_constructible_v<plain_type>)) {
+            if constexpr(stl::is_aggregate_v<plain_type> && (sizeof...(Args) != 0u || !stl::is_default_constructible_v<plain_type>)) {
                 this->instance = new plain_type{stl::forward<Args>(args)...};
             } else if constexpr(std::is_array_v<plain_type>) {
                 static_assert(sizeof...(Args) == 0u, "Invalid arguments");

+ 2 - 2
src/entt/entity/storage.hpp

@@ -374,7 +374,7 @@ protected:
                 return base_type::end();
             }
         } else {
-            if constexpr(std::is_default_constructible_v<element_type>) {
+            if constexpr(stl::is_default_constructible_v<element_type>) {
                 return emplace_element(entt, force_back);
             } else {
                 return base_type::end();
@@ -667,7 +667,7 @@ public:
      */
     template<typename... Args>
     value_type &emplace(const entity_type entt, Args &&...args) {
-        if constexpr(stl::is_aggregate_v<value_type> && (sizeof...(Args) != 0u || !std::is_default_constructible_v<value_type>)) {
+        if constexpr(stl::is_aggregate_v<value_type> && (sizeof...(Args) != 0u || !stl::is_default_constructible_v<value_type>)) {
             const auto it = emplace_element(entt, false, Type{stl::forward<Args>(args)...});
             return element_at(static_cast<size_type>(it.index()));
         } else {

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

@@ -114,7 +114,7 @@ struct basic_meta_sequence_container_traits {
      * @return True in case of success, false otherwise.
      */
     [[nodiscard]] static bool resize([[maybe_unused]] void *container, [[maybe_unused]] const size_type sz) {
-        if constexpr(std::is_default_constructible_v<typename Type::value_type> && requires(Type elem) { elem.resize(sz); }) {
+        if constexpr(stl::is_default_constructible_v<typename Type::value_type> && requires(Type elem) { elem.resize(sz); }) {
             static_cast<Type *>(container)->resize(sz);
             return true;
         } else {

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

@@ -228,7 +228,7 @@ auto setup_node_for() noexcept {
         size_of_v<Type>,
         &resolve<stl::remove_const_t<stl::remove_pointer_t<Type>>>};
 
-    if constexpr(std::is_default_constructible_v<Type>) {
+    if constexpr(stl::is_default_constructible_v<Type>) {
         node.default_constructor = +[](const meta_ctx &ctx) {
             return meta_any{ctx, std::in_place_type<Type>};
         };

+ 1 - 1
src/entt/signal/dispatcher.hpp

@@ -69,7 +69,7 @@ public:
 
     template<typename... Args>
     void enqueue(Args &&...args) {
-        if constexpr(stl::is_aggregate_v<Type> && (sizeof...(Args) != 0u || !std::is_default_constructible_v<Type>)) {
+        if constexpr(stl::is_aggregate_v<Type> && (sizeof...(Args) != 0u || !stl::is_default_constructible_v<Type>)) {
             events.push_back(Type{stl::forward<Args>(args)...});
         } else {
             events.emplace_back(stl::forward<Args>(args)...);

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

@@ -10,6 +10,7 @@ using std::decay_t;
 using std::false_type;
 using std::invoke_result_t;
 using std::is_aggregate_v;
+using std::is_default_constructible_v;
 using std::is_invocable_r_v;
 using std::is_lvalue_reference_v;
 using std::is_member_object_pointer_v;