Allocate storage for n values through alloc, honoring over‐alignment.

Synopsis

Declared in <folly/Memory.h>

template<
    typename Alloc,
    size_t kAlign = alignof(typename std::allocator_traits<Alloc>::value_type)>
std::allocator_traits<Alloc>::pointer
allocateOverAligned(
    Alloc const& alloc,
    size_t n);

Description

Works like std::allocator_traits<Alloc>::allocate, but handles over‐aligned types. Feel free to manually specify any power of two as the Align template arg. Must be matched with deallocateOverAligned. allocationBytesForOverAligned will give you the number of bytes that this function actually requests.

Return Value

A pointer to storage for n values.

Parameters

Name

Description

alloc

The allocator to allocate the storage through.

n

The number of values to allocate storage for.

Created with MrDocs