std::meta::offset_of
Defined in header <meta> | ||
|---|---|---|
consteval std::meta::member_offset offset_of( std::meta::info r ); | (since C++26) |
Returns the offset of the non-static data member or direct base class represented by r relative to its enclosing class std::meta::parent_of(r).
Parameters
| r | - | a reflection of a non-static data member or direct base class relationship |
Return value
Let V be the offset in bits from the beginning of a complete object of the type represented by std::meta::parent_of(r) to the subobject associated with what r represents. Returns std::meta::member_offset{V % CHAR_BIT, V % CHAR_BIT}.
Exceptions
Throws std::meta::exception unless r represents one of the following:
- non-static data member
- unnamed bit-field
- direct base class relationship for which either the base class is not a virtual base class or the derived class is not an abstract class
Example
See also
| byte offset from the beginning of a standard-layout type to specified member (function macro) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/offset_of