Allocate raw storage for one or more t_TYPE objects.

Synopsis

Declared in <bslma_allocatorutil.h>

template<
    class t_TYPE,
    class t_ALLOCATOR>
static
AllocatorUtil_Traits<t_ALLOCATOR, t_TYPE>::pointer
allocateObject(
    t_ALLOCATOR const& allocator,
    std::size_t n = 1);

Description

Return a pointer to a block of raw memory allocated from the specified allocator having a size and alignment appropriate for an object of (templatize parameter) t_TYPE. Optionally specify n for the number of objects; otherwise space for a single object is allocated. Since t_TYPE cannot be deduced from the function parameters, it must be supplied explicitly (in <> brackets) by the caller.

Return Value

pointer to raw storage suitably sized and aligned for n objects of type t_TYPE

Parameters

Name

Description

allocator

allocator from which to allocate

n

number of objects of type t_TYPE to allocate space for

Created with MrDocs