Namespaces
Variants

std::meta::bases_of

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Reflection queries
Reflection layout queries
Type properties
Type property queries
 
Defined in header <meta>
consteval std::vector<std::meta::info>
    bases_of( std::meta::info type, std::meta::access_context ctx );
(since C++26)

Returns a std::vector that contains the reflections corresponding to the base specifiers of the class represented by type, filtered by the access context ctx.

Let C be the class type represented by std::meta::dealias(type). Each reflection value b in the result represents an accessible direct base class relationship between C and one of C's base classes. Accessibility is determined as if by std::meta::is_accessible(b, ctx). The reflection values appear in the order in which the corresponding base classes appear in the base clause of the definition of C.

A direct base class relationship is typically represented as an ordered pair (D, B), where:

  • D is the derived class.
  • B is the direct base class named by a base specifier in the definition of D.

The functions std::meta::parent_of and std::meta::type_of respectively return the derived class and the base class of the relationship.

Parameters

type - a reflection value that represents either a complete class type or a type alias thereof
ctx - an access context

Return value

A std::vector of reflection values that represents direct base class relationships.

Exceptions

Throws std::meta::exception unless std::meta::dealias(type) represents a class type that is complete from some point in the evaluation context.

Notes

If type represents a union type, the result is an empty vector.

Example

See also