---
name: "std::aligned_storage"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::aligned_storage"
---

# std::aligned\_storage(3)

Aligned storage.

## NAME

std::aligned\_storage\< \_Len, \_Align \> - Aligned storage.

## SYNOPSIS

\#include \<type\_traits\>

## Detailed Description

### template\<size\_t \_Len, size\_t \_Align = \_\_aligned\_storage\_default\_alignment(\_Len)\>

struct std::aligned\_storage\< \_Len, \_Align \>"Aligned storage.

The member typedef type is be a POD type suitable for use as uninitialized storage for any object whose size is at most \_Len and whose alignment is a divisor of \_Align.

It is important to use the nested type as uninitialized storage, not the std::aligned\_storage type itself which is an empty class with 1-byte alignment. So this is correct:

typename std::aligned\_storage\<sizeof(X), alignof(X)\>::type m\_xobj;

This is wrong:

std::aligned\_storage\<sizeof(X), alignof(X)\> m\_xobj;

In C++14 and later std::aligned\_storage\_t\<sizeof(X), alignof(X)\> can be used to refer to the type member typedef.

The default value of \_Align is supposed to be the most stringent fundamental alignment requirement for any C++ object type whose size is no greater than \_Len (see \[basic.align\] in the C++ standard).

**Deprecated**

Deprecated in C++23. Uses can be replaced by an array std::byte\[\_Len\] declared with alignas(\_Align).

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
