skypjack 22 часов назад
Родитель
Сommit
2690c8af2b

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

@@ -186,7 +186,7 @@ public:
 
     /*! @brief Default constructor. */
     constexpr basic_any() noexcept
-        : basic_any{std::in_place_type<void>} {}
+        : basic_any{stl::in_place_type<void>} {}
 
     /**
      * @brief Constructs a wrapper by directly initializing the new object.
@@ -195,7 +195,7 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    explicit basic_any(std::in_place_type_t<Type>, Args &&...args)
+    explicit basic_any(stl::in_place_type_t<Type>, Args &&...args)
         : base_type{} {
         initialize<Type>(stl::forward<Args>(args)...);
     }
@@ -207,7 +207,7 @@ public:
      */
     template<typename Type>
     requires (!stl::is_const_v<Type> && !stl::is_void_v<Type>)
-    explicit basic_any(std::in_place_t, Type *value)
+    explicit basic_any(stl::in_place_t, Type *value)
         : base_type{} {
         if(value == nullptr) {
             initialize<void>();
@@ -226,7 +226,7 @@ public:
     template<typename Type>
     requires (!std::same_as<stl::remove_cvref_t<Type>, basic_any>)
     basic_any(Type &&value)
-        : basic_any{std::in_place_type<stl::decay_t<Type>>, stl::forward<Type>(value)} {}
+        : basic_any{stl::in_place_type<stl::decay_t<Type>>, stl::forward<Type>(value)} {}
 
     /**
      * @brief Copy constructor.
@@ -601,7 +601,7 @@ template<typename Type, std::size_t Len, std::size_t Align>
  */
 template<typename Type, std::size_t Len = basic_any<>::length, std::size_t Align = basic_any<Len>::alignment, typename... Args>
 [[nodiscard]] basic_any<Len, Align> make_any(Args &&...args) {
-    return basic_any<Len, Align>{std::in_place_type<Type>, stl::forward<Args>(args)...};
+    return basic_any<Len, Align>{stl::in_place_type<Type>, stl::forward<Args>(args)...};
 }
 
 /**
@@ -614,7 +614,7 @@ template<typename Type, std::size_t Len = basic_any<>::length, std::size_t Align
  */
 template<std::size_t Len = basic_any<>::length, std::size_t Align = basic_any<Len>::alignment, typename Type>
 [[nodiscard]] basic_any<Len, Align> forward_as_any(Type &&value) {
-    return basic_any<Len, Align>{std::in_place_type<Type &&>, stl::forward<Type>(value)};
+    return basic_any<Len, Align>{stl::in_place_type<Type &&>, stl::forward<Type>(value)};
 }
 
 } // namespace entt

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

@@ -146,7 +146,7 @@ struct type_info final {
      */
     template<typename Type>
     // NOLINTBEGIN(modernize-use-transparent-functors)
-    constexpr type_info(std::in_place_type_t<Type>) noexcept
+    constexpr type_info(stl::in_place_type_t<Type>) noexcept
         : seq{type_index<stl::remove_cvref_t<Type>>::value()},
           identifier{type_hash<stl::remove_cvref_t<Type>>::value()},
           alias{type_name<stl::remove_cvref_t<Type>>::value()} {}
@@ -214,7 +214,7 @@ private:
 template<typename Type>
 [[nodiscard]] const type_info &type_id() noexcept {
     if constexpr(stl::is_same_v<Type, stl::remove_cvref_t<Type>>) {
-        static const type_info instance{std::in_place_type<Type>};
+        static const type_info instance{stl::in_place_type<Type>};
         return instance;
     } else {
         return type_id<stl::remove_cvref_t<Type>>();

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

@@ -144,7 +144,7 @@ public:
 
     template<typename Type, typename... Args>
     Type &emplace_as(const id_type id, Args &&...args) {
-        return any_cast<Type &>(ctx.try_emplace(id, std::in_place_type<Type>, stl::forward<Args>(args)...).first->second);
+        return any_cast<Type &>(ctx.try_emplace(id, stl::in_place_type<Type>, stl::forward<Args>(args)...).first->second);
     }
 
     template<typename Type, typename... Args>

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

@@ -248,8 +248,8 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    explicit meta_any(std::in_place_type_t<Type>, Args &&...args)
-        : meta_any{locator<meta_ctx>::value_or(), std::in_place_type<Type>, stl::forward<Args>(args)...} {}
+    explicit meta_any(stl::in_place_type_t<Type>, Args &&...args)
+        : meta_any{locator<meta_ctx>::value_or(), stl::in_place_type<Type>, stl::forward<Args>(args)...} {}
 
     /**
      * @brief Constructs a wrapper by directly initializing the new object.
@@ -259,8 +259,8 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    explicit meta_any(const meta_ctx &area, std::in_place_type_t<Type>, Args &&...args)
-        : storage{std::in_place_type<Type>, stl::forward<Args>(args)...},
+    explicit meta_any(const meta_ctx &area, stl::in_place_type_t<Type>, Args &&...args)
+        : storage{stl::in_place_type<Type>, stl::forward<Args>(args)...},
           ctx{&area},
           vtable{&basic_vtable<stl::remove_cvref_t<Type>>} {}
 
@@ -270,8 +270,8 @@ public:
      * @param value A pointer to an object to take ownership of.
      */
     template<typename Type>
-    explicit meta_any(std::in_place_t, Type *value)
-        : meta_any{locator<meta_ctx>::value_or(), std::in_place, value} {}
+    explicit meta_any(stl::in_place_t, Type *value)
+        : meta_any{locator<meta_ctx>::value_or(), stl::in_place, value} {}
 
     /**
      * @brief Constructs a wrapper taking ownership of the passed object.
@@ -280,8 +280,8 @@ public:
      * @param value A pointer to an object to take ownership of.
      */
     template<typename Type>
-    explicit meta_any(const meta_ctx &area, std::in_place_t, Type *value)
-        : storage{std::in_place, value},
+    explicit meta_any(const meta_ctx &area, stl::in_place_t, Type *value)
+        : storage{stl::in_place, value},
           ctx{&area},
           vtable{storage ? &basic_vtable<Type> : nullptr} {
     }
@@ -305,7 +305,7 @@ public:
     template<typename Type>
     requires (!std::same_as<stl::remove_cvref_t<Type>, meta_any>)
     meta_any(const meta_ctx &area, Type &&value)
-        : meta_any{area, std::in_place_type<stl::decay_t<Type>>, stl::forward<Type>(value)} {}
+        : meta_any{area, stl::in_place_type<stl::decay_t<Type>>, stl::forward<Type>(value)} {}
 
     /**
      * @brief Context aware copy constructor.
@@ -672,7 +672,7 @@ private:
  */
 template<typename Type>
 [[nodiscard]] meta_any forward_as_meta(const meta_ctx &ctx, Type &&value) {
-    return meta_any{ctx, std::in_place_type<Type &&>, stl::forward<Type>(value)};
+    return meta_any{ctx, stl::in_place_type<Type &&>, stl::forward<Type>(value)};
 }
 
 /**
@@ -695,7 +695,7 @@ class meta_handle {
 
     template<typename Type, typename... Args>
     meta_handle(char, Type &value, Args &&...args)
-        : any{stl::forward<Args>(args)..., std::in_place_type<Type &>, value} {}
+        : any{stl::forward<Args>(args)..., stl::in_place_type<Type &>, value} {}
 
 public:
     /*! Default constructor. */

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

@@ -230,7 +230,7 @@ auto setup_node_for() noexcept {
 
     if constexpr(stl::is_default_constructible_v<Type>) {
         node.default_constructor = +[](const meta_ctx &ctx) {
-            return meta_any{ctx, std::in_place_type<Type>};
+            return meta_any{ctx, stl::in_place_type<Type>};
         };
     }
 
@@ -247,15 +247,15 @@ auto setup_node_for() noexcept {
     if constexpr(!stl::is_void_v<Type> && !stl::is_function_v<Type>) {
         node.from_void = +[](const meta_ctx &ctx, void *elem, const void *celem) {
             if(elem && celem) { // ownership construction request
-                return meta_any{ctx, std::in_place, static_cast<stl::decay_t<Type> *>(elem)};
+                return meta_any{ctx, stl::in_place, static_cast<stl::decay_t<Type> *>(elem)};
             }
 
             if(elem) { // non-const reference construction request
-                return meta_any{ctx, std::in_place_type<stl::decay_t<Type> &>, *static_cast<stl::decay_t<Type> *>(elem)};
+                return meta_any{ctx, stl::in_place_type<stl::decay_t<Type> &>, *static_cast<stl::decay_t<Type> *>(elem)};
             }
 
             // const reference construction request
-            return meta_any{ctx, std::in_place_type<const stl::decay_t<Type> &>, *static_cast<const stl::decay_t<Type> *>(celem)};
+            return meta_any{ctx, stl::in_place_type<const stl::decay_t<Type> &>, *static_cast<const stl::decay_t<Type> *>(celem)};
         };
     }
 

+ 5 - 5
src/entt/meta/utility.hpp

@@ -169,11 +169,11 @@ template<meta_policy Policy = as_value_t, typename Type>
 [[nodiscard]] meta_any meta_dispatch(const meta_ctx &ctx, [[maybe_unused]] Type &&value) {
     if constexpr(stl::is_same_v<Policy, as_cref_t>) {
         static_assert(stl::is_lvalue_reference_v<Type>, "Invalid type");
-        return meta_any{ctx, std::in_place_type<const stl::remove_reference_t<Type> &>, stl::as_const(value)};
+        return meta_any{ctx, stl::in_place_type<const stl::remove_reference_t<Type> &>, stl::as_const(value)};
     } else if constexpr(stl::is_same_v<Policy, as_ref_t> || (stl::is_same_v<Policy, as_is_t> && stl::is_lvalue_reference_v<Type>)) {
-        return meta_any{ctx, std::in_place_type<Type>, value};
+        return meta_any{ctx, stl::in_place_type<Type>, value};
     } else if constexpr(stl::is_same_v<Policy, as_void_t>) {
-        return meta_any{ctx, std::in_place_type<void>};
+        return meta_any{ctx, stl::in_place_type<void>};
     } else {
         return meta_any{ctx, stl::forward<Type>(value)};
     }
@@ -198,7 +198,7 @@ template<typename Policy, typename Candidate, typename... Args>
 [[nodiscard]] meta_any meta_invoke_with_args(const meta_ctx &ctx, Candidate &&candidate, Args &&...args) {
     if constexpr(stl::is_void_v<decltype(std::invoke(stl::forward<Candidate>(candidate), args...))>) {
         std::invoke(stl::forward<Candidate>(candidate), args...);
-        return meta_any{ctx, std::in_place_type<void>};
+        return meta_any{ctx, stl::in_place_type<void>};
     } else {
         return meta_dispatch<Policy>(ctx, std::invoke(stl::forward<Candidate>(candidate), args...));
     }
@@ -231,7 +231,7 @@ template<typename Type, typename... Args, std::size_t... Index>
 [[nodiscard]] meta_any meta_construct(const meta_ctx &ctx, meta_any *const args, std::index_sequence<Index...>) {
     // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic) - waiting for C++20 (and std::span)
     if(((args + Index)->allow_cast<Args>() && ...)) {
-        return meta_any{ctx, std::in_place_type<Type>, (args + Index)->cast<Args>()...};
+        return meta_any{ctx, stl::in_place_type<Type>, (args + Index)->cast<Args>()...};
     }
     // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic)
 

+ 3 - 3
src/entt/poly/poly.hpp

@@ -213,8 +213,8 @@ public:
      * @param args Parameters to use to construct the instance.
      */
     template<typename Type, typename... Args>
-    explicit basic_poly(std::in_place_type_t<Type>, Args &&...args)
-        : storage{std::in_place_type<Type>, stl::forward<Args>(args)...},
+    explicit basic_poly(stl::in_place_type_t<Type>, Args &&...args)
+        : storage{stl::in_place_type<Type>, stl::forward<Args>(args)...},
           vtable{poly_vtable<Concept, Len, Align>::template instance<stl::remove_cvref_t<Type>>()} {}
 
     /**
@@ -225,7 +225,7 @@ public:
     template<typename Type>
     requires (!std::same_as<stl::remove_cvref_t<Type>, basic_poly>)
     basic_poly(Type &&value) noexcept
-        : basic_poly{std::in_place_type<stl::remove_cvref_t<Type>>, stl::forward<Type>(value)} {}
+        : basic_poly{stl::in_place_type<stl::remove_cvref_t<Type>>, stl::forward<Type>(value)} {}
 
     /**
      * @brief Returns the object type info if any, `type_id<void>()` otherwise.

+ 4 - 0
src/entt/stl/utility.hpp

@@ -10,6 +10,10 @@ using std::as_const;
 using std::declval;
 using std::exchange;
 using std::forward;
+using std::in_place;
+using std::in_place_t;
+using std::in_place_type;
+using std::in_place_type_t;
 using std::make_pair;
 using std::move;
 using std::pair;