std::meta::alignment_of
| Defined in header <meta>
|
||
consteval std::size_t alignment_of( std::meta::info r );
|
(since C++26) | |
Returns the alignment requirement of the type or (sub)object represented by r.
Parameters
| r | - | a reflection value |
Return value
If r represents a type “reference to T”, returns alignof(T*).
Otherwise, if r represents a type U, returns alignof(U).
Otherwise, if r represents a variable or object, returns the alignment requirement of the variable or object.
Otherwise, if r represents a direct base class relationship, returns the alignment requirement of the base class (i.e. std::meta::alignment_of(std::meta::type_of(r))).
Otherwise, if r represents a non-static data member M of a class C, returns the alignment requirement of the corresponding direct member subobject of a complete object of type C.
Otherwise, r represents a data member description, returns its alignment value if not ⊥, or std::meta::alignment_of(std::meta::type_of(r)) otherwise.
Exceptions
Throws std::meta::exception unless all of the following conditions are met:
std::meta::dealias(r)represents one of the following:
- type
- object
- variable of non-reference type
- non-static data member that is not a bit-field
- direct base class relationship
- data member description whose bit width is ⊥
- If
std::meta::dealias(r)represents a type,std::meta::is_complete_type(r)istrue.
Notes
This function treats “reference of T” the same as “pointer to T”. This matches the representation of non-static reference members.
Example
| This section is incomplete Reason: no example |
See also
alignof (C++11)
|
queries alignment requirements of a type (operator) |