Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::tbb_allocator< T > Class Template Reference

Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...

#include <tbb_allocator.h>

Collaboration diagram for tbb::tbb_allocator< T >:

Classes

struct  rebind
 

Public Types

enum  malloc_type { scalable, standard }
 Specifies current allocator. More...
 
typedef internal::allocator_type< T >::value_type value_type
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 tbb_allocator () throw ()
 
 tbb_allocator (const tbb_allocator &) throw ()
 
template<typename U >
 tbb_allocator (const tbb_allocator< U > &) throw ()
 
pointer address (reference x) const
 
const_pointer address (const_reference x) const
 
pointer allocate (size_type n, const void *=0)
 Allocate space for n objects. More...
 
void deallocate (pointer p, size_type)
 Free previously allocated block of memory. More...
 
size_type max_size () const throw ()
 Largest value for which method allocate might succeed. More...
 
template<typename U , typename... Args>
void construct (U *p, Args &&... args)
 Copy-construct value at location pointed to by p. More...
 
void destroy (pointer p)
 Destroy value at location pointed to by p. More...
 

Static Public Member Functions

static malloc_type allocator_type ()
 Returns current allocator. More...
 

Detailed Description

template<typename T>
class tbb::tbb_allocator< T >

Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.

The class selects the best memory allocation mechanism available from scalable_malloc and standard malloc. The members are ordered the same way they are in section 20.4.1 of the ISO C++ standard.

Definition at line 58 of file tbb_allocator.h.

Member Typedef Documentation

◆ const_pointer

template<typename T >
typedef const value_type* tbb::tbb_allocator< T >::const_pointer

Definition at line 62 of file tbb_allocator.h.

◆ const_reference

template<typename T >
typedef const value_type& tbb::tbb_allocator< T >::const_reference

Definition at line 64 of file tbb_allocator.h.

◆ difference_type

template<typename T >
typedef ptrdiff_t tbb::tbb_allocator< T >::difference_type

Definition at line 66 of file tbb_allocator.h.

◆ pointer

template<typename T >
typedef value_type* tbb::tbb_allocator< T >::pointer

Definition at line 61 of file tbb_allocator.h.

◆ reference

template<typename T >
typedef value_type& tbb::tbb_allocator< T >::reference

Definition at line 63 of file tbb_allocator.h.

◆ size_type

template<typename T >
typedef size_t tbb::tbb_allocator< T >::size_type

Definition at line 65 of file tbb_allocator.h.

◆ value_type

template<typename T >
typedef internal::allocator_type<T>::value_type tbb::tbb_allocator< T >::value_type

Definition at line 60 of file tbb_allocator.h.

Member Enumeration Documentation

◆ malloc_type

template<typename T >
enum tbb::tbb_allocator::malloc_type

Specifies current allocator.

Enumerator
scalable 
standard 

Definition at line 72 of file tbb_allocator.h.

Constructor & Destructor Documentation

◆ tbb_allocator() [1/3]

template<typename T >
tbb::tbb_allocator< T >::tbb_allocator ( )
throw (
)
inline

Definition at line 77 of file tbb_allocator.h.

77 {}

◆ tbb_allocator() [2/3]

template<typename T >
tbb::tbb_allocator< T >::tbb_allocator ( const tbb_allocator< T > &  )
throw (
)
inline

Definition at line 78 of file tbb_allocator.h.

78 {}

◆ tbb_allocator() [3/3]

template<typename T >
template<typename U >
tbb::tbb_allocator< T >::tbb_allocator ( const tbb_allocator< U > &  )
throw (
)
inline

Definition at line 79 of file tbb_allocator.h.

79 {}

Member Function Documentation

◆ address() [1/2]

template<typename T >
pointer tbb::tbb_allocator< T >::address ( reference  x) const
inline

Definition at line 81 of file tbb_allocator.h.

81 {return &x;}

◆ address() [2/2]

template<typename T >
const_pointer tbb::tbb_allocator< T >::address ( const_reference  x) const
inline

Definition at line 82 of file tbb_allocator.h.

82 {return &x;}

◆ allocate()

template<typename T >
pointer tbb::tbb_allocator< T >::allocate ( size_type  n,
const void = 0 
)
inline

Allocate space for n objects.

Definition at line 85 of file tbb_allocator.h.

85  {
87  }
value_type * pointer
Definition: tbb_allocator.h:61
internal::allocator_type< T >::value_type value_type
Definition: tbb_allocator.h:60
void *__TBB_EXPORTED_FUNC allocate_via_handler_v3(size_t n)
Allocates memory using MallocHandler.

References tbb::internal::allocate_via_handler_v3().

Referenced by tbb::interface6::internal::token_helper< T, true >::create_token().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allocator_type()

template<typename T >
static malloc_type tbb::tbb_allocator< T >::allocator_type ( )
inlinestatic

Returns current allocator.

Definition at line 116 of file tbb_allocator.h.

116  {
118  }
bool __TBB_EXPORTED_FUNC is_malloc_used_v3()
Returns true if standard malloc/free are used to work with memory.

References tbb::internal::is_malloc_used_v3(), tbb::tbb_allocator< T >::scalable, and tbb::tbb_allocator< T >::standard.

Here is the call graph for this function:

◆ construct()

template<typename T >
template<typename U , typename... Args>
void tbb::tbb_allocator< T >::construct ( U *  p,
Args &&...  args 
)
inline

Copy-construct value at location pointed to by p.

Definition at line 103 of file tbb_allocator.h.

104  { ::new((void *)p) U(std::forward<Args>(args)...); }
void const char const char int ITT_FORMAT __itt_group_sync p

References p.

◆ deallocate()

template<typename T >
void tbb::tbb_allocator< T >::deallocate ( pointer  p,
size_type   
)
inline

Free previously allocated block of memory.

Definition at line 90 of file tbb_allocator.h.

90  {
92  }
void __TBB_EXPORTED_FUNC deallocate_via_handler_v3(void *p)
Deallocates memory using FreeHandler.
void const char const char int ITT_FORMAT __itt_group_sync p

References tbb::internal::deallocate_via_handler_v3(), and p.

Referenced by tbb::interface6::internal::token_helper< T, true >::destroy_token().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy()

template<typename T >
void tbb::tbb_allocator< T >::destroy ( pointer  p)
inline

Destroy value at location pointed to by p.

Definition at line 113 of file tbb_allocator.h.

113 {p->~value_type();}
void const char const char int ITT_FORMAT __itt_group_sync p

References p.

Referenced by tbb::interface6::internal::token_helper< T, true >::destroy_token().

Here is the caller graph for this function:

◆ max_size()

template<typename T >
size_type tbb::tbb_allocator< T >::max_size ( ) const
throw (
)
inline

Largest value for which method allocate might succeed.

Definition at line 95 of file tbb_allocator.h.

95  {
96  size_type max = static_cast<size_type>(-1) / sizeof (value_type);
97  return (max > 0 ? max : 1);
98  }
T max(const T &val1, const T &val2)
Utility template function returning greater of the two values.
Definition: tbb_misc.h:119
internal::allocator_type< T >::value_type value_type
Definition: tbb_allocator.h:60

References tbb::internal::max().

Here is the call graph for this function:

The documentation for this class was generated from the following file:

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.