次の方法で共有


allocator_traits::allocate メソッド

特定のアロケーター パラメーターを使用してメモリを割り当てる静的メソッド。

static pointer allocate(Alloc& al, size_type count);
static pointer allocate(Alloc& al, size_type count,
    typename allocator_traits<void>::const_pointer *hint);

パラメーター

  • al
    アロケーター オブジェクト。

  • count
    代入する要素の数。

  • hint
    要求前に割り当てられたオブジェクトのアドレスを検索して、ストレージの要求を満たすことのアロケーター オブジェクトに役立てます const_pointer。 null ポインターは、ヒント扱われません。

戻り値

各メソッド割り当てられたオブジェクトへのポインターを返します。

最初の静的メソッドは al.allocate(count)を返します。

この式が正しく構成されている場合は、2 番目のメソッドは al.allocate(count, hint); それ以外の場合は al.allocate(count)を返します。

必要条件

ヘッダー: <memory>

名前空間: std

参照

関連項目

allocator::allocate

allocator_traits クラス