stl: std::allocator_arg[_t]

This commit is contained in:
skypjack
2026-04-15 14:22:26 +02:00
parent 5623d2f9dc
commit 64a71a4e8d
4 changed files with 8 additions and 6 deletions

View File

@@ -39,15 +39,15 @@ struct dense_map_node final {
element{stl::forward<Args>(args)...} {}
template<typename... Args>
dense_map_node(std::allocator_arg_t, const auto &allocator, const stl::size_t pos, Args &&...args)
dense_map_node(stl::allocator_arg_t, const auto &allocator, const stl::size_t pos, Args &&...args)
: next{pos},
element{entt::make_obj_using_allocator<value_type>(allocator, stl::forward<Args>(args)...)} {}
dense_map_node(std::allocator_arg_t, const auto &allocator, const dense_map_node &other)
dense_map_node(stl::allocator_arg_t, const auto &allocator, const dense_map_node &other)
: next{other.next},
element{entt::make_obj_using_allocator<value_type>(allocator, other.element)} {}
dense_map_node(std::allocator_arg_t, const auto &allocator, dense_map_node &&other)
dense_map_node(stl::allocator_arg_t, const auto &allocator, dense_map_node &&other)
: next{other.next},
element{entt::make_obj_using_allocator<value_type>(allocator, stl::move(other.element))} {}

View File

@@ -123,8 +123,8 @@ struct uses_allocator_construction {
} else {
static_assert(std::uses_allocator_v<Type, Allocator>, "Ill-formed request");
if constexpr(stl::is_constructible_v<Type, std::allocator_arg_t, const Allocator &, Params...>) {
return stl::tuple<std::allocator_arg_t, const Allocator &, Params &&...>{std::allocator_arg, allocator, stl::forward<Params>(params)...};
if constexpr(stl::is_constructible_v<Type, stl::allocator_arg_t, const Allocator &, Params...>) {
return stl::tuple<stl::allocator_arg_t, const Allocator &, Params &&...>{stl::allocator_arg, allocator, stl::forward<Params>(params)...};
} else {
static_assert(stl::is_constructible_v<Type, Params..., const Allocator &>, "Ill-formed request");
return stl::forward_as_tuple(stl::forward<Params>(params)..., allocator);

View File

@@ -115,7 +115,7 @@ public:
*/
template<std::derived_from<Service> Type = Service, typename... Args>
requires std::constructible_from<Type, Args...>
static Service &emplace(std::allocator_arg_t, auto alloc, Args &&...args) {
static Service &emplace(stl::allocator_arg_t, auto alloc, Args &&...args) {
service = std::allocate_shared<Type>(alloc, stl::forward<Args>(args)...);
return *service;
}

View File

@@ -8,6 +8,8 @@
/*! @cond ENTT_INTERNAL */
namespace entt::stl {
using std::allocator_arg;
using std::allocator_arg_t;
using std::allocator_traits;
using std::make_unique;
using std::pointer_traits;