4 template <
class,
class Alloc,
class... Args>
11 Args...> : std::true_type {};
17 template <
class Alloc,
class Po
inter,
class =
void>
20 template <
class Alloc,
class Po
inter>
24 template <
class Alloc,
class Type>
30 template <
class Alloc,
class T>
33 template <
class T,
class U>
36 template <
class Alloc,
class Type>
38 : std::negation<has_construct<Alloc, Type*, const Type&>> {};
44 template <
class Alloc,
class Iter,
class Sent>
47 std::allocator_traits<Alloc>::destroy(
alloc, std::to_address(
first));
50 template <
class Alloc,
class Iter>
56 void operator()()
const {
57 allocator_destroy(alloc_, std::reverse_iterator<Iter>(last_), std::reverse_iterator<Iter>(first_));
72 template <
class Alloc,
class Iter1,
class Sent1,
class Iter2>
73 Iter2 uninitialized_allocator_copy_impl(
80 auto guard = make_exception_guard(
95 class RawTypeIn = std::remove_const_t<In>,
98 requires (std::is_trivially_copy_constructible_v<RawTypeIn> &&
99 std::is_trivially_copy_assignable_v<RawTypeIn> &&
100 std::is_same_v<std::remove_const_t<In>, std::remove_const_t<Out>> &&
101 allocator_has_trivial_copy_construct<Alloc, RawTypeIn>::value)
102 Out* uninitialized_allocator_copy_impl(Alloc&, In* first1, In* last1, Out* first2) {
103 return std::copy(first1, last1,
const_cast<RawTypeIn*
>(first2));
106 template <
class Alloc,
class Iter1,
class Sent1,
class Iter2>
107 Iter2 uninitialized_allocator_copy(Alloc& alloc, Iter1 first1, Sent1 last1, Iter2 first2) {
108 return uninitialized_allocator_copy_impl(alloc, std::move(first1), std::move(last1), std::move(first2));
125 template <
class Alloc,
class T>
126 constexpr void uninitialized_allocator_relocate(Alloc& alloc, T* first, T* last, T* result) {
127 if (std::is_constant_evaluated() ||
128 !is_trivially_relocatable<T>::value ||
129 !allocator_has_trivial_move_construct<Alloc, T>::value ||
130 !allocator_has_trivial_destroy<Alloc, T>::value
132 auto destruct_first = result;
133 auto guard = make_exception_guard(
134 AllocatorDestroyRangeReverse<Alloc, T*>(alloc, destruct_first, result)
137 while (iter != last) {
138 std::allocator_traits<Alloc>::construct(
141#
if PLUGIFY_HAS_EXCEPTIONS
142 std::move_if_noexcept(*iter)
151 allocator_destroy(alloc, first, last);
154 std::memcpy(
static_cast<void*
>(result), first,
sizeof(T) *
static_cast<size_t>(last - first));