[#bsl-allocator-0a-allocate]
= xref:bsl.adoc[bsl]::xref:bsl/allocator-0a.adoc[allocator&lt;void&gt;]::allocate
:relfileprefix: ../../
:mrdocs:

Return storage for `n` objects of `value&lowbar;type`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
xref:bsl/allocator-0df.adoc[pointer]
allocate(
    xref:bsl/allocator-0df.adoc[size&lowbar;type] n,
    void const* hint = 0);
----

== Description

Return a block of memory having sufficient size and alignment to hold the specified `n` objects of `value&lowbar;type`, allocated from the memory resource held by this allocator&period; The optionally specified `hint` is ignored by this allocator type but may be used by other allocators as an aid for optimizing locality&period;

== Return Value

pointer to the allocated storage

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *n*
| number of objects to allocate storage for
| *hint*
| optional locality hint (ignored by this allocator)
|===


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