Implement new type policy requirements for flat containers

This commit is contained in:
Christian Mazakas
2023-01-04 11:13:25 -08:00
parent 6e41418744
commit cb4e636d78
2 changed files with 34 additions and 0 deletions

View File

@ -60,6 +60,23 @@ namespace boost {
return {std::move(const_cast<raw_key_type&>(x.first)),
std::move(const_cast<raw_mapped_type&>(x.second))};
}
template <class A>
static void construct(A& al, storage_type* p, moved_type&& x)
{
boost::allocator_construct(al, p, std::move(x));
}
template <class A, class... Args>
static void construct(A& al, storage_type* p, Args&&... args)
{
boost::allocator_construct(al, p, std::forward<Args>(args)...);
}
template <class A> static void destroy(A& al, storage_type* p) noexcept
{
boost::allocator_destroy(al, p);
}
};
using table_type = detail::foa::table<map_types, Hash, KeyEqual,

View File

@ -44,6 +44,23 @@ namespace boost {
static Key const& extract(value_type const& key) { return key; }
static Key&& move(value_type& x) { return std::move(x); }
template <class A>
static void construct(A& al, storage_type* p, Key&& x)
{
boost::allocator_construct(al, p, std::move(x));
}
template <class A, class... Args>
static void construct(A& al, storage_type* p, Args&&... args)
{
boost::allocator_construct(al, p, std::forward<Args>(args)...);
}
template <class A> static void destroy(A& al, storage_type* p) noexcept
{
boost::allocator_destroy(al, p);
}
};
using table_type = detail::foa::table<set_types, Hash, KeyEqual,