[#BloombergLP-bslma-AllocatorUtil-allocateObject]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/AllocatorUtil.adoc[AllocatorUtil]::allocateObject
:relfileprefix: ../../../
:mrdocs:

Allocate raw storage for one or more `t&lowbar;TYPE` objects&period;

== Synopsis

Declared in `&lt;bslma&lowbar;allocatorutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class t&lowbar;TYPE,
    class t&lowbar;ALLOCATOR&gt;
static
AllocatorUtil&lowbar;Traits&lt;t&lowbar;ALLOCATOR, t&lowbar;TYPE&gt;::pointer
allocateObject(
    t&lowbar;ALLOCATOR const& allocator,
    std::size&lowbar;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&lowbar;TYPE`&period; Optionally specify `n` for the number of objects&semi; otherwise space for a single object is allocated&period; Since `t&lowbar;TYPE` cannot be deduced from the function parameters, it must be supplied explicitly (in `&lt;&gt;` brackets) by the caller&period;

== Return Value

pointer to raw storage suitably sized and aligned for `n` objects of type `t&lowbar;TYPE`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *allocator*
| allocator from which to allocate
| *n*
| number of objects of type `t&lowbar;TYPE` to allocate space for
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
