TypeInfo
-
struct TypeInfo
Runtime specification of a compile time type. Use the function
type_of<T>()to obtain an instance ofTypeInfofor some typeT.For example,
type_of<int>().name()should return"int"andtype_of<float*>().is_pointer()should returntrue.Public Functions
-
inline const std::string &name() const
Canonical name of this type in C++.
-
inline constexpr size_t size() const
Storage size of this type in bytes.
-
inline constexpr size_t alignment() const
Alignment of this type in bytes.
-
inline constexpr bool is_pointer() const
Is this type a pointer.
-
inline constexpr bool is_const() const
Is this type
const. For example,const intandfloat* constare constant, butintandconst float*are not constant.
-
inline constexpr bool is_empty() const
Check if this type is empty, i.e., a class with no non-static fields. Similar to
std::is_emptybut callable at runtime.
-
inline constexpr bool is_trivially_copyable() const
Check if this type is trivial copyable, i.e., no ctor or dtor. Similar to
std::is_trivially_copyablebut callable at runtime.
-
inline constexpr TypeInfo remove_pointer() const
If this type is a pointer, returns the type pointed to by this type. Similar to
std::remove_pointerbut callable at runtime.
-
inline const std::string &name() const