# std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::allocate

> C++ Atlas: `cppatlas.com/w/cpp/memory/scoped_allocator_adaptor/allocate` | Source: https://en.cppreference.com/w/cpp/memory/scoped_allocator_adaptor/allocate | Domain: Memory management | Standards: C++11

Uses the outer allocator to allocate uninitialized storage.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <scoped_allocator>
pointer allocate( size_type n ); // (1) (since C++11)
pointer allocate( size_type n, const_void_pointer hint ); // (2) (since C++11)
```

Uses the outer allocator to allocate uninitialized storage.

1) Calls `std::allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)`.

2) Additionally provides memory locality hint, by calling `std::allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)`.

### Parameters

- `n` - the number of objects to allocate storage for
- `hint` - pointer to a nearby memory location

### Return value

The pointer to the allocated storage.

### See also

- [`allocate`](https://en.cppreference.com/w/cpp/memory/allocator/allocate): allocates uninitialized storage (public member function of `std::allocator<T>`)
- [`allocate`](https://en.cppreference.com/w/cpp/memory/allocator_traits/allocate) [static]: allocates uninitialized storage using the allocator (public static member function of `std::allocator_traits<Alloc>`)

---
Attribution: content from https://en.cppreference.com/w/cpp/memory/scoped_allocator_adaptor/allocate (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.