Make CTL definitions less ambiguous

This commit is contained in:
Justine Tunney 2024-07-01 03:48:28 -07:00
parent 239f8ce76e
commit acbabedf27
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
30 changed files with 176 additions and 173 deletions

View file

@ -18,10 +18,10 @@ struct allocator_traits
using difference_type = typename Alloc::difference_type;
using size_type = typename Alloc::size_type;
using propagate_on_container_copy_assignment = false_type;
using propagate_on_container_move_assignment = true_type;
using propagate_on_container_swap = false_type;
using is_always_equal = true_type;
using propagate_on_container_copy_assignment = ctl::false_type;
using propagate_on_container_move_assignment = ctl::true_type;
using propagate_on_container_swap = ctl::false_type;
using is_always_equal = ctl::true_type;
template<typename T>
using rebind_alloc = typename Alloc::template rebind<T>::other;
@ -29,41 +29,34 @@ struct allocator_traits
template<typename T>
using rebind_traits = allocator_traits<rebind_alloc<T>>;
__attribute__((__always_inline__)) static pointer allocate(Alloc& a,
size_type n)
static pointer allocate(Alloc& a, size_type n)
{
return a.allocate(n);
}
__attribute__((__always_inline__)) static void deallocate(Alloc& a,
pointer p,
size_type n)
static void deallocate(Alloc& a, pointer p, size_type n)
{
a.deallocate(p, n);
}
template<typename T, typename... Args>
__attribute__((__always_inline__)) static void construct(Alloc& a,
T* p,
Args&&... args)
static void construct(Alloc& a, T* p, Args&&... args)
{
::new ((void*)p) T(static_cast<Args&&>(args)...);
}
template<typename T>
__attribute__((__always_inline__)) static void destroy(Alloc& a, T* p)
static void destroy(Alloc& a, T* p)
{
p->~T();
}
__attribute__((__always_inline__)) static size_type max_size(
const Alloc& a) noexcept
static size_type max_size(const Alloc& a) noexcept
{
return __PTRDIFF_MAX__ / sizeof(value_type);
}
__attribute__((__always_inline__)) static Alloc
select_on_container_copy_construction(const Alloc& a)
static Alloc select_on_container_copy_construction(const Alloc& a)
{
return a;
}