Freigeben über


allocator_traits::allocate Method

Static method that allocates memory by using the given allocator parameter.

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

Parameters

  • al
    An allocator object.

  • count
    The number of elements to allocate.

  • hint
    A const_pointer that might assist the allocator object in satisfying the request for storage by locating the address of an allocated object prior to the request. A null pointer is treated as no hint.

Return Value

Each method returns a pointer to the allocated object.

The first static method returns al.allocate(count).

The second method returns al.allocate(count, hint), if that expression is well formed; otherwise it returns al.allocate(count).

Requirements

Header: <memory>

Namespace: std

See Also

Reference

allocator::allocate

allocator_traits Class