10#ifndef MVE_ALIGNED_ALLOCATOR_HEADER
11#define MVE_ALIGNED_ALLOCATOR_HEADER
29template <
typename T,
size_t alignment>
50 template <
class T_other,
size_t alignment_other>
59 template <
class T_other,
size_t alignment_other>
62 template <
class T_other,
size_t alignment_other>
68template <
typename T,
size_t alignment>
74template <
typename T,
size_t alignment>
75template <
class T_other,
size_t alignment_other>
82template <
typename T,
size_t alignment>
86 if (n > this->max_size())
87 throw std::bad_alloc();
88 size_t size = n *
sizeof(T);
91 p =
reinterpret_cast<pointer>(::_aligned_malloc(size, alignment));
93 throw std::bad_alloc();
95 if (::posix_memalign(&
reinterpret_cast<void*&
>(p), alignment, size))
96 throw std::bad_alloc();
101template <
typename T,
size_t alignment>
112template <
typename T,
size_t alignment>
116 return std::numeric_limits<size_t>::max() /
sizeof(T);
119template <
typename T,
size_t alignment>
123 ::new((
void*)p) T(other);
126template <
typename T,
size_t alignment>
133template <
typename T,
size_t alignment>
134template <
class T_other,
size_t alignment_other>
142template <
typename T,
size_t alignment>
143template <
class T_other,
size_t alignment_other>
AlignedAllocator< U, alignment > other
Implements the STL allocator interface for aligned memory allocation.
std::ptrdiff_t difference_type
T const & const_reference
#define UTIL_NAMESPACE_BEGIN
#define UTIL_NAMESPACE_END