[#bsl-allocator_traits-0ae-allocate-01] = xref:bsl.adoc[bsl]::xref:bsl/allocator_traits-0ae.adoc[allocator_traits<std::allocator<ALLOCATOR_TYPE>>]::allocate :relfileprefix: ../../ :mrdocs: Allocate memory. == Synopsis Declared in `<bslma_allocatortraits.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] constexpr static pointer allocate( _Alloc& __a, size_type __n, const_void_pointer __hint); ---- == Description Returns if that expression is well‐formed, otherwise returns `a.allocate(n)` == Return Value Memory of suitable size and alignment for _n_ objects of type `value_type` [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *__a* | An allocator. | *__n* | The number of objects to allocate space for. | *__hint* | Aid to locality. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#