Allocator コンセプト

インテル® TBB で実装されるアロケーターの Allocator コンセプトは ISO C++ 標準の表 32 の「Allocator 要件」に似ていますが、ISO C++ コンテナーの使用にはさらなる保証が必要です。下記の表は、Allocator コンセプトを要約したものです。ここで、A と B はアロケーター・クラスのインスタンスを表します。

Allocator コンセプト

擬似署名

意味

typedef T* A::pointer

T へのポインター。

typedef const T* A::const_pointer

const T へのポインター。

typedef T& A::reference

T への参照。

typedef const T& A::const_reference

const T への参照。

typedef T A::value_type

割り当てる値の型。

typedef size_t A::size_type

値の数を表す型。

typedef ptrdiff_t A::difference_type

ポインターの差を表す型。

template<typename U> struct rebind { typedef A<U> A::other;};

異なる U 型に再バインドします。

A() throw()

デフォルト・コンストラクター。

A( const A& ) throw()

コピー・コンストラクター。

template<typename U> A( const A& )

再バインド・コンストラクター。

~A() throw()

デストラクター。

T* A::address( T& x ) const

アドレスを取得します。

const T* A::const_address( const T& x ) const

const アドレスを取得します。

T* A::allocate( size_type n, const void* hint=0 )

n 値に空間を割り当てます。

void A::deallocate( T* p, size_t  n )

n 値の割り当てを解除します。

size_type A::max_size() const throw()

allocate メソッドに許可されている最大値引数。

void A::construct( T* p, const T& value )

new(p) T(value)

void A::destroy( T* p ) p->T::~T()
bool operator==( const A&, const B& )

true を返します。

bool operator!=( const A&, const B& )

false を返します。

モデル型

tbb_allocatorscalable_allocatorcached_aligned_allocatorzero_allocator テンプレート・クラスは、Allocator コンセプトをモデル化します。

関連情報