17 #ifndef __TBB_tbb_allocator_H 18 #define __TBB_tbb_allocator_H 22 #if __TBB_ALLOCATOR_CONSTRUCT_VARIADIC 45 #if _MSC_VER && !defined(__INTEL_COMPILER) 47 #pragma warning (push) 48 #pragma warning (disable: 4100) 81 pointer
address(reference x)
const {
return &x;}
82 const_pointer
address(const_reference x)
const {
return &x;}
85 pointer
allocate( size_type n,
const void* = 0) {
96 size_type
max =
static_cast<size_type
>(-1) /
sizeof (value_type);
97 return (max > 0 ? max : 1);
101 #if __TBB_ALLOCATOR_CONSTRUCT_VARIADIC 102 template<
typename U,
typename... Args>
104 { ::new((
void *)p) U(std::forward<Args>(args)...); }
105 #else // __TBB_ALLOCATOR_CONSTRUCT_VARIADIC 106 #if __TBB_CPP11_RVALUE_REF_PRESENT 107 void construct( pointer
p, value_type&&
value ) {::new((
void*)(p)) value_type(
std::move(
value));}
109 void construct( pointer p,
const value_type&
value ) {::new((
void*)(p)) value_type(value);}
110 #endif // __TBB_ALLOCATOR_CONSTRUCT_VARIADIC 121 #if _MSC_VER && !defined(__INTEL_COMPILER) 122 #pragma warning (pop) 123 #endif // warning 4100 is back 133 template<
typename U>
struct rebind {
138 template<
typename T,
typename U>
141 template<
typename T,
typename U>
150 template <
typename T,
template<
typename X>
class Allocator =
tbb_allocator>
156 typedef typename base_allocator_type::pointer
pointer;
158 typedef typename base_allocator_type::reference
reference;
160 typedef typename base_allocator_type::size_type
size_type;
171 pointer
allocate(
const size_type n,
const void *hint = 0 ) {
172 pointer ptr = base_allocator_type::allocate( n, hint );
173 std::memset( static_cast<void*>(ptr), 0, n *
sizeof(value_type) );
180 template<
template<
typename T>
class Allocator>
185 typedef typename base_allocator_type::pointer
pointer;
187 template<
typename U>
struct rebind {
192 template<
typename T1,
template<
typename X1>
class B1,
typename T2,
template<
typename X2>
class B2>
194 return static_cast< B1<T1>
>(a) ==
static_cast< B2<T2>
>(b);
196 template<
typename T1,
template<
typename X1>
class B1,
typename T2,
template<
typename X2>
class B2>
198 return static_cast< B1<T1>
>(a) !=
static_cast< B2<T2>
>(b);
const_pointer address(const_reference x) const
zero_allocator< U, Allocator > other
void move(tbb_thread &t1, tbb_thread &t2)
base_allocator_type::reference reference
base_allocator_type::const_pointer const_pointer
void destroy(pointer p)
Destroy value at location pointed to by p.
pointer address(reference x) const
bool __TBB_EXPORTED_FUNC is_malloc_used_v3()
Returns true if standard malloc/free are used to work with memory.
void deallocate(pointer p, size_type)
Free previously allocated block of memory.
void *__TBB_EXPORTED_FUNC allocate_via_handler_v3(size_t n)
Allocates memory using MallocHandler.
base_allocator_type::value_type value_type
void construct(U *p, Args &&... args)
Copy-construct value at location pointed to by p.
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
base_allocator_type::value_type value_type
base_allocator_type::pointer pointer
zero_allocator(const zero_allocator &a)
base_allocator_type::const_reference const_reference
T max(const T &val1, const T &val2)
Utility template function returning greater of the two values.
malloc_type
Specifies current allocator.
base_allocator_type::difference_type difference_type
const void * const_pointer
tbb_allocator(const tbb_allocator< U > &)
ptrdiff_t difference_type
pointer allocate(const size_type n, const void *hint=0)
static malloc_type allocator_type()
Returns current allocator.
tbb_allocator(const tbb_allocator &)
const value_type & const_reference
zero_allocator(const zero_allocator< U > &a)
void __TBB_EXPORTED_FUNC deallocate_via_handler_v3(void *p)
Deallocates memory using FreeHandler.
base_allocator_type::pointer pointer
size_type max_size() const
Largest value for which method allocate might succeed.
bool operator!=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
bool operator==(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
void const char const char int ITT_FORMAT __itt_group_sync p
const value_type * const_pointer
internal::allocator_type< T >::value_type value_type
base_allocator_type::size_type size_type
base_allocator_type::const_pointer const_pointer
zero_allocator< U, Allocator > other
Allocator< T > base_allocator_type
#define __TBB_EXPORTED_FUNC
pointer allocate(size_type n, const void *=0)
Allocate space for n objects.
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Allocator< void > base_allocator_type