std::align_val_t(3)
π NAME π
std::align_val_t β std::align_val_t. That's the name, bestie, and it's iconic for exactly that reason π«Ά. This page is from the C++ Standard Libary (yes, that's the manual name right there β spelling included, not me being quirky π
).
β¨ Synopsis β¨
Defined in header <new>:
enum class align_val_t : std::size_t {};
(since C++17) π
Both new-expression and delete-expression, when used with objects whose alignment requirement is greater than __STDCPP_DEFAULT_NEW_ALIGNMENT__, pass that alignment requirement as an argument of type std::align_val_t to the selected allocation/deallocation function. That's the whole mechanic, and it ate β¨.
πΈ Notes πΈ
Alignment (as obtained by alignof) has the type std::size_t, but placement forms of allocation and deallocation functions that take std::size_t as an additional parameter are already in use, so this type is used instead. No cap, the std::size_t slot was already in use, so this type steps in instead π
.
Feature-test macro check:
__cpp_aligned_newβ value201606L, std(C++17), feature: Dynamic memory allocation for over-aligned data. That's the receipt π§Ύβ¨.
π See also π
operator newβ allocation functionsoperator new[]β(function)operator deleteβ deallocation functionsoperator delete[]β(function)
mwah π β source http://cppreference.com, version/date 2024.06.10, page std::align_val_t(3).
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms