std:: max_align_t
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Basic types | |||||||||||
| Fixed width integer types (C++11) | |||||||||||
| Fixed width floating-point types (C++23) | |||||||||||
| Numeric limits | |||||||||||
| C numeric limits interface | |||||||||||
| Runtime type information | |||||||||||
|
|||||||||||
|
Definiert im Header
<cstddef>
|
||
|
typedef
/* implementation-defined */
max_align_t
;
|
(seit C++11) | |
std::max_align_t
ist ein
Standard-Layout
TrivialType
(bis C++26)
TriviallyCopyable
Typ
(seit C++26)
, dessen
Ausrichtungsanforderung
mindestens so streng (so groß) ist wie die jedes skalaren Typs.
std:: is_trivially_default_constructible_v < std :: max_align_t > ist true .
Inhaltsverzeichnis |
Hinweise
Von Allokierungsfunktionen wie
std::malloc
zurückgegebene Zeiger sind für jedes Objekt geeignet ausgerichtet, was bedeutet, dass sie mindestens so streng ausgerichtet sind wie
std::max_align_t
.
Beispiel
#include <cstddef> #include <iostream> int main() { std::cout << alignof(std::max_align_t) << '\n'; }
Mögliche Ausgabe:
16
Referenzen
- C++23-Standard (ISO/IEC 14882:2024):
-
- 17.2.4 Größen, Ausrichtungen und Offsets [support.types.layout] (S. 504-505)
- C++20-Standard (ISO/IEC 14882:2020):
-
- 17.2.4 Größen, Ausrichtungen und Offsets [support.types.layout] (S. 507-508)
- C++17-Standard (ISO/IEC 14882:2017):
-
- 21.2.4 Größen, Ausrichtungen und Offsets [support.types.layout] (S. 479)
- C++14-Standard (ISO/IEC 14882:2014):
-
- 18.2 Typen [support.types] (S. 443-444)
- C++11-Standard (ISO/IEC 14882:2011):
-
- 18.2 Typen [support.types] (S. 454-455)
Siehe auch
alignof
(C++11)
|
fragt die Ausrichtungsanforderungen eines Typs ab
(Operator) |
|
(C++11)
|
ermittelt die Ausrichtungsanforderungen eines Typs
(Klassentemplate) |
|
(C++11)
|
prüft, ob ein Typ ein Skalartyp ist
(Klassentemplate) |
|
C-Dokumentation
für
max_align_t
|
|