21 #ifndef __TBB_cache_aligned_allocator_H 22 #define __TBB_cache_aligned_allocator_H 25 #include "tbb_stddef.h" 26 #if __TBB_ALLOCATOR_CONSTRUCT_VARIADIC 36 size_t __TBB_EXPORTED_FUNC NFS_GetLineSize();
40 void* __TBB_EXPORTED_FUNC NFS_Allocate(
size_t n_element,
size_t element_size,
void* hint );
45 void __TBB_EXPORTED_FUNC NFS_Free(
void* );
49 #if _MSC_VER && !defined(__INTEL_COMPILER) 51 #pragma warning (push) 52 #pragma warning (disable: 4100) 62 typedef typename internal::allocator_type<T>::value_type value_type;
63 typedef value_type* pointer;
64 typedef const value_type* const_pointer;
65 typedef value_type& reference;
66 typedef const value_type& const_reference;
67 typedef size_t size_type;
68 typedef ptrdiff_t difference_type;
77 pointer address(reference x)
const {
return &x;}
78 const_pointer address(const_reference x)
const {
return &x;}
81 pointer
allocate( size_type n,
const void* hint=0 ) {
83 return pointer(internal::NFS_Allocate( n,
sizeof(value_type), const_cast<void*>(hint) ));
88 internal::NFS_Free(p);
93 return (~
size_t(0)-internal::NFS_MaxLineSize)/
sizeof(value_type);
97 #if __TBB_ALLOCATOR_CONSTRUCT_VARIADIC 98 template<
typename U,
typename... Args>
99 void construct(U *p, Args&&... args)
100 { ::new((
void *)p) U(std::forward<Args>(args)...); }
101 #else // __TBB_ALLOCATOR_CONSTRUCT_VARIADIC 102 #if __TBB_CPP11_RVALUE_REF_PRESENT 103 void construct( pointer p, value_type&& value ) {::new((
void*)(p)) value_type(std::move(value));}
105 void construct( pointer p,
const value_type& value ) {::new((
void*)(p)) value_type(value);}
106 #endif // __TBB_ALLOCATOR_CONSTRUCT_VARIADIC 112 #if _MSC_VER && !defined(__INTEL_COMPILER) 113 #pragma warning (pop) 114 #endif // warning 4100 is back 121 typedef void* pointer;
122 typedef const void* const_pointer;
123 typedef void value_type;
124 template<
typename U>
struct rebind {
129 template<
typename T,
typename U>
132 template<
typename T,
typename U>
size_type max_size() const
Largest value for which method allocate might succeed.
Definition: cache_aligned_allocator.h:92
pointer allocate(size_type n, const void *hint=0)
Allocate space for n objects, starting on a cache/sector line.
Definition: cache_aligned_allocator.h:81
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Definition: cache_aligned_allocator.h:60
Definition: _flow_graph_async_msg_impl.h:32
void deallocate(pointer p, size_type)
Free block of memory that starts on a cache line.
Definition: cache_aligned_allocator.h:87
The namespace tbb contains all components of the library.
Definition: parallel_for.h:44
void construct(pointer p, const value_type &value)
Copy-construct value at location pointed to by p.
Definition: cache_aligned_allocator.h:105
Definition: cache_aligned_allocator.h:69
void destroy(pointer p)
Destroy value at location pointed to by p.
Definition: cache_aligned_allocator.h:109