29 using const_pointer =
const T*;
31 using const_reference =
const T&;
34 using difference_type = ptrdiff_t;
36 T* address( T& r )
const {
return &r; }
38 const T* address(
const T& s )
const {
return &s; }
52 bool operator!=(
const AlignedAllocator& other )
const {
return !( *
this == other ); }
54 void construct( T*
const p,
const T& t )
const {
55 void*
const pv =
static_cast<void*
>( p );
59 void destroy( T*
const p )
const { p->~T(); }
85 if ( n == 0 ) {
return NULL; }
90 CORE_ASSERT( n <= max_size(),
"Integer overflow" );
92#if !defined ARCH_ARM32 && !defined ARCH_ARM64 || defined _WIN32
93 void*
const pv = _mm_malloc( n *
sizeof( T ), Alignment );
95 void*
const pv = aligned_alloc( Alignment, n *
sizeof( T ) );
99 CORE_ASSERT( pv != NULL,
" Bad alloc" );
100 CORE_ASSERT( (
reinterpret_cast<std::size_t>( pv ) & ( Alignment - 1 ) ) == 0,
101 "Alignment constraint not satisfied" );
103 return static_cast<T*
>( pv );
106 void deallocate( T*
const p,
const std::size_t )
const {
107#if !defined ARCH_ARM32 && !defined ARCH_ARM64 || defined _WIN32
115 template <
typename U>
116 T* allocate(
const std::size_t n,
const U* )
const {
117 return allocate( n );