3.3. RareTs%3A Reflection - TheNitesWhoSay/RareCpp GitHub Wiki

Access Protection

  • access_modifier_v - Enum trait getting the access modifier for the given field in the given object
  • AccessMod - Enum class representing access modifiers, has members "Public", "Protected" and "Private"

Notes / Annotations

  • is_overload_note - Bool trait indicating whether a given note describes an overload
  • is_super_note - Bool trait indicating whether a given annotation type describes a super class
  • sub_notes - Retrieves a structure containing the notes of the subnote at index I of type T, if an index is provided, or T::notes otherwise
  • AnnotationsType - The interface for accessing annotation/NOTE details; is used by members, overloads, supers, and classes
  • NoNote - Alias for the type of a NOTE with no members (std::tuple<>)
  • noNote - Value of type NoNote, is identical to the value a NOTE with no members would have
  • Notes - Interface for class-level annotations on a given class

Functions

  • arguments_t - Typedef of function arguments as a tuple given a function
  • argument_count_v - Count of function arguments given a function
  • argument_t - Typedef of function argument given a function and argument index
  • is_instance_method - Bool trait indicating whether the given function pointer with the given args is an instance method (non-static member function)
  • is_overloaded - Bool trait indicating whether member with the given index of the given type is an overloaded function
  • member_of_t - Type trait which retrieves the struct/class for which the given function is a non-static member
  • return_type_t - Type trait that gets the return type for a given function
  • ArgumentBuilder - Function argument builder
  • Function - Given a function pointer, describes deducible properties of a function and provides arg-builder based invoke capabilities

Overloaded Functions

  • KnownOverloads - The interface for accessing information about known overloads (that is, overloads whose arguments were declared in NOTEs)
  • NotedOverload - Annotation type describing a NOTE'd overload; obtained when calling operator() on RareTs::Overload
  • Overload - Annotation used to describe an overload
  • OverloadInfo - Type used to get info about an overload given its arguments (this should only be used when overload arguments were not supplied in NOTEs)
  • OverloadType - Annotation type describing an overload

General Reflection

  • is_aggregate_reflected - Bool trait indicating whether the given type is reflected by virtue of being an aggregate and not being reflected by other means.
  • is_in_class_reflected - Bool trait indicating whether the given type is reflected via the in-class REFLECT or REFLECT_NOTED macro.
  • is_private_reflected - Bool trait indicating whether a given type has been reflected using REFLECT_PRIVATE, REFLECT_PRIVATE_NOTED, or REFLECT_PRIVATE_EMPTY.
  • is_proxied - Bool trait indicating whether a given type is reflected via a RareTs::Proxy
  • is_reflected - Bool trait indicating whether a given type has reflection information (via the REFLECT or REFLECT_NOTED macros, or via RareTs::Proxy)
  • Class - RareTs::Class is a friend of reflected structures and provides low-level access to the members of T::Class, direct use of Class is discouraged
  • GlobalClass - GlobalClass specializations are automatically generated by the REFLECT_PRIVATE, REFLECT_PRIVATE_NOTED and REFLECT_PRIVATE_EMPTY macros to add reflection information to a type
  • Proxy - Type template specialized in order to reflect public or protected members a struct/class (usually one that is not owned by the coder), the specialization of RareTs::Proxy contains a REFLECT or REFLECT_NOTED macro and may have notes as though they were on the members in the proxy'd struct/class
  • Reflect - A high level interface for accessing reflected information for the given struct/class type

Members

  • enable_if_member_t - Used like std::enable_if_t to check whether a type is a RareTs::Member, its use is required when writing member-filters
  • is_member - Bool trait indicating whether a given type is a RareTs::Member or not
  • member_type_tuple - Type trait that gets a std::tuple of the types of the reflected members, optionally with a filter
  • passes_filter - Bool trait indicating whether the given type or given member satisfies the given predicate/filter
  • Filter - Defines several common member filters
  • IndexOf - Given a type, enumerates the indexes of members
  • Member - Given a reflected struct/class type and a member index, describes the properties of a member
  • Members - The primary interface for iterating, packing, or otherwise accessing the members of a reflected struct/class
  • MemberType - Type which has all the RareTs::Member's for a given reflected struct/class available to be accessed using submember identifiers
  • Values - Interface providing iteration, packing, or other forms of access to member values for a given reflected struct/class
  • tuplify(t) - Returns a tuple-like type wrapping the given reflected object, providing tuple-like access to the members of the reflected object

Inheritance

  • Inherit - Aliases as "Supers", the interface for accessing super-class information for the given reflected struct/class
  • NotedSuper - Annotation type describing a NOTE'd super-class relationship; obtained when calling operator() on RareTs::Super
  • Super - Annotation describing a super-class relationship
  • SuperClass - Annotation type describing a super-class relationship
  • SuperInfo - Type detailing a single super-class relationship
  • Supers - Type which describes all super-class relationships for a given type

Access Protection

access_modifier_v<T, MemberIndex>

  • <T>: The object type in which you're getting an access modifier
  • <MemberIndex>: The index of the member for which you're getting the access modifier

Returns AccessMod::Public, AccessMod::Protected or AccessMod::Private depending on the accessibility of member at "MemberIndex" in "T".


AccessMod

  • Public = 0
  • Protected = 1
  • Private = 2

Enum for class-member access modifiers.


Notes / Annotations

is_overload_note<T>

  • <T>: The type of the note
  • value: bool indicating whether the type "T" was of type OverloadType or NotedOverload

Bool trait checking whether the given type was a NOTE describing an overload (specialization of OverloadType or NotedOverload).


is_super_note<T>

  • <T>: The type of the note
  • value: bool indicating whether the type "T" was of type SuperClass or NotedSuper

Bool trait checking whether the given type was a NOTE describing a super-class (specialization of SuperClass or NotedSuper).


sub_notes<T, I>

  • <T>: The root object containing note information
  • <I>: The index (or integral constant type, or void) indicating which sub-note this is within the root notes
  • value: A reference to the sub_notes tuple

Notes exist as a static constexpr tuple with identifier "notes" in some type T, sub_notes is used to get a references to said "notes" if I is void/not an index; or a reference to notes contained within the Ith note within T::notes (std::get<I>(T::notes)::notes) if I is a valid index.

Super-class relationships and overloads, which are described within a note, may have notes attached to themselves (sub-notes), which this class is used to get in a generic manner.


AnnotationsType<Root, SubIndex, Is...>

  • <Root>: The root note-wrapper type which contains a static constexpr member "notes"
  • <SubIndex>: An integral constant index of the sub-notes which this AnnotationsType instance describes (may be void/none)
  • <Is...>: The indexes valid for this instances of AnnotationsType (normally all note indexes in these notes, but internally Supers and Overloads use this to apply a filter)
  • notes: The tuple containing the values of the annotations
  • Notes: The type of the tuple containing the values of the annotations
  • hasNote<Annotation>(): returns a bool indicating whether the type "Annotation" is contained within these annotations
  • hasNote<Of>(): returns a bool indicating whether a specialization of template "Of" is contained within these annotations
  • getNote<Annotation>(): returns the value for the first instance of type "Annotation" within these annotations
  • getNote<Of>(): returns the value for the first specialization of template "Of" within these annotations
  • forEachNote(f): calls f once for each note within these annotations with the note value as the only argument
  • forEachNote<Annotation>(f): calls f once for each note of type "Annotation" within these annotations with the note value as the only argument
  • forEachNote<Of>(f): calls f once for each note specialization template "Of" within these annotations with the note value as the only argument

NoNote

Type alias for the type of the annotations on a member that has not been annotated (std::tuple<>).


noNote

Value representing the value of annotations on a member that has not been annotated (NoNote{}).


Notes<T>

  • <T> The type on which to examine class-level annotations

The interface for class-level annotations on object "T", uses the common interface AnnotationsType.


Functions

arguments_t<F>

  • <F> Function pointer type on which to get argument types

Tuple type containing all of the argument types for the given function.


argument_count_v<F>

  • <F> Function pointer type on which to get the argument count

size_t representing the total number of arguments for the given function.


argument_t<I, F>

  • <I>: The index of the argument type to get
  • <F>: Function pointer type on which to get the argument type

Type of the Ith argument of the given function.


is_instance_method<F, Args...>

  • <F>: Function pointer type to check

Bool trait checking whether the given function is an instance method (aka non-static member function).


is_overloaded<T, I>

  • <T>: Object type on which to check whether a member is an overloaded function
  • <I>: Index of member to check

Bool trait checking whether the given member of the given object is an overloaded function (RareCpp considers a member to be "overloaded" when you can neither get the type of the member nor the pointer type of the member without application of any overload deduction techniques, consequently unsupported or non-present/typo'd members in REFLECT macros will also be considered "overloaded").


member_of_t<F>

  • <F>: Function pointer type to check

The object type in which this function is an instance-method (aka non-static member function). If the function is not an instance-method in some object then member_of_t is void.


return_type_t<F>

  • <F>: Function pointer type of which to get the return type

The return type of the function.


ArgumentBuilder<Ts...>

  • <Ts...>: The types of the arguments to build
  • Argument: has members "type" - the type of the argument; and "index" - the index of the argument
  • invoke(f, argBuilder): builds all of the arguments (of types Ts...) by invoking argBuilder(Argument<T, I>{}), and invokes f with all said arguments
  • invokeInstance(t, f, argBuilder): builds all of the arguments (of types Ts...) by invoking argBuilder(Argument<T, I>{}), and invokes member function "f" on object "t" with all said arguments

A helper class used to dynamically create argument sets (e.g. parse arguments off of a JSON structure) to be passed to a function whose argument types have been deduced (e.g. with RareTs::arguments_t or through overload reflection)


Function<F>

<F> The type of the function pointer

  • pointer_type: the type of the function pointer this abstracts ("F")
  • pointer: the value of the function pointer/member function pointer (if using an instance of Function)
  • Arguments: A tuple containing the types of the arguments for this function
  • ArgumentCount: The count of the arguments for this function
  • Argument<I>: The type of the Ith argument for this function
  • IsMemberFunction: Bool indicating whether this is an instance-member function (non-static member function)
  • Return: The return type of this function
  • MemberOf: The type this function is a member of (if this is an instance-member/non-static-member function)
  • invoke(argBuilder): builds all of the arguments (using each argument type T and each argument index I) by invoking argBuilder(ArgumentBuilder::Argument<T, I>{}), and invokes f with all said arguments
  • invoke(t, argBuilder): builds all of the arguments (using each argument type T and each argument index I) by invoking argBuilder(ArgumentBuilder::Argument<T, I>{}) and invokes member function f on object t with all said arguments

Overloaded Functions

KnownOverloads<T, MemberIndex, MemberNotes>

  • <T>: The object type
  • <MemberIndex>: The member index upon which to examine known overloads
  • <MemberNotes>: The notes on this member
  • class_type: The object type "T"
  • memberIndex: The member index "MemberIndex"
  • totalArgumentSets: The total number of NOTE'd, unique argument sets
  • Overload<I, Q=void>: An interface for the Ith overload (extends the common AnnotationsType interface as well as the Function interface), if there are multiple qualifications, Q indicates the exact qualifications of function you want, Q=void (default) gives you the least-qualified version of a function.
  • ResolveOverload<I, Q>: An interface for the Ith overload (extends the common AnnotationsType interface as well as the Function interface), Q indicates the qualification of the object-type upon which you would call such an overloaded function, resolves to the best-match version of the function given those qualifications.
  • forEach(Q, function): Iterates all best-match overloads on qualified object Q, calling function once per argument set with the overload you would get from ResolveOverload
  • forEach<Q>(function): Iterates all best-match overloads for a qualified object Q, calling function once per argument set with the overload you would get from ResolveOverload
  • forEach(function): Iterates all overloaded argument sets, calls function once per argument set with the least-qualified overload you'd get from Overload<I, void>
  • at(Q, index, function): Calls function with the best-match overload on qualified object Q ("ResolveOverload<I, Q>"), with the index'th argument set
  • at<Q>(index, function): Calls function with the best-match overload on qualified object Q ("ResolveOverload<I, Q>"), with the index'th argument set
  • at(index, function): Calls function with the least qualified overload you'd get from Overload<index, void>
  • pack(Q, function): Calls function with a pack of best-match overloads as you'd get from ResolveOverload<I, Q>, for all argument set indexes I
  • pack<Q>(function): Calls function with a pack of best-match overloads as you'd get from ResolveOverload<I, Q>, for all argument set indexes I
  • pack(function): Calls function with a pack of least-qualified overloads as you'd get from Overload<index, void>, for all argument set indexes I

NotedOverload<ArgTypes, Ts...>

  • <ArgTypes>: The argument types for the overload
  • <Ts...>: The types of the argument notes
  • ArgumentTypes: A tuple containing the types of the arguments ("ArgTypes")
  • Notes: A tuple type containing all the types of the note values
  • notes: A tuple containing all of the note values

NotedOverload is the type that is created upon invoking operator() on an "Overload" note, NotedOverload contains the notes for a particular overload.


Overload<Ts...>

  • <Ts...>: The argument types for an overload
  • ArgumentTypes: A tuple type containing the types of the arguments (std::tuple<Ts...>)
  • Notes: A tuple type representing the lack of notes on the overload (RareTs::NoNote)
  • notes: A tuple value representing the lack of notes on the overload (RareTs::NoNote{})

The annotation used to describe an overload.


OverloadInfo<Class, MemberIndex, Args...>

  • <Class>: The class on which to get non-noted overload information
  • <MemberIndex>: The index of the member for which to get non-noted overload information
  • <Args...>: The argument types of the overload for which you wish to get information
  • class_type: The class type "Class"
  • argument_types: A tuple type containing the argument types (std::tuple<Args...>)
  • pointer_types: The pointer types for every qualification of this overload
  • pointer_type<Q=void>: The pointer type for the given qualification (or least-qualified version) of this overload
  • resolve_pointer_type<Q>: The pointer type of the overload that would be resolved given object qualifications Q for the given args
  • memberIndex: The index of this member ("MemberIndex")
  • isStatic: bool indicating whether this overload appears to be static
  • resolvePointer<Q>: The pointer value of this overload that would be resolved on given object qualifications Q for the given args
  • totalQualifications: The total unique qualifications for this overload for the given args

OverloadType<Ts...>

  • <Ts...>: The types of the arguments for this overload
  • Notes: A tuple type representing the lack of notes on the overload (RareTs::NoNote)
  • notes: A tuple value representing the lack of notes on the overload (RareTs::NoNote{})

The structure backing the note "Overload<Ts...>"


General Reflection


is_aggregate_reflected<T>

  • <T>: The object type to check
  • value: bool indicating whether "T" is reflected by virtue of being an aggregate and not being reflected by other means

Bool trait indicating whether the given type is reflected by virtue of being an aggregate and not being reflected by other means.


is_in_class_reflected<T>

  • <T>: The object type to check
  • value: bool indicating whether "T" is reflected via the in-class REFLECT or REFLECT_NOTED macro

Bool trait indicating whether the given type is reflected via the in-class REFLECT or REFLECT_NOTED macro.


is_private_reflected<T>

  • <T>: The object type to check
  • value: bool indicating whether "T" was reflected using REFLECT_PRIVATE, REFLECT_PRIVATE_NOTED, or REFLECT_PRIVATE_EMPTY (or otherwise by a specialization of GlobalClass).

Bool trait indicating whether the given type was reflected using REFLECT_PRIVATE, REFLECT_PRIVATE_NOTED, or REFLECT_PRIVATE_EMPTY (or otherwise by a specialization of GlobalClass).


is_proxied<T>

  • <T>: The object type to check
  • value: bool indicating whether "T" is reflected using a proxy

Bool trait indicating whether the given type is reflected using a proxy.


is_reflected<T>

  • <T>: The object type to check
  • value: bool indicating whether "T" is reflected (with one of the regular REFLECT macros, through a proxy, or by virtue of being an aggregate)

Bool trait indicating whether a given type has reflection information via any of the reflect macros, regularly, through a proxy, or by virtue of being an aggregate.


Class

Direct use of Class is discouraged, Class holds many of the implementation details for reflection and can provide low-level access to reflected information, direct use can be difficult and yield unintuitive results that may differ by compiler. Excepting adapt_member and adapt_member_type when building adaptive structures, it's strongly encouraged to use the facilities provided through RareTs::Members, RareTs::Member, RareTs::Supers, RareTs::Notes, etc.

  • NullptrType: REFLECT macro detail defaulted to when pointer type is not otherwise valid, has one member "type = std::nullptr_t"
  • EmptyComponent: REFLECT macro detail defaulted to when value type is not otherwise valid, has type = void and ::s() & ::i() both of which return a reference to a nullptr instance
  • NonPointable: REFLECT macro detail defaulted to when pointer value is not otherwise valid, has one member "p = nullptr"
  • NonNoted: REFLECT macro detail defaulted to when notes are not present on a member, has one member "notes = std::tuple{}"
  • NoOffset: REFLECT macro detail defaulted to when member offset is not otherwise valid, has one member ::() which returns std::numeric_limits<size_t>::max()
  • OverloadIdentifier: REFLECT macro detail used to deduce overloads of potentially differing qualifications given object type, return type, and argument types
  • unproxy_t: Used to get the type of a reflected class without the proxy if present, or just the same type it's given if no proxy is present
  • forward_proxy: Changes a type "T" into a type "P" with the same cv-ref qualifications as that of "T", used to get a reflection proxy for an object of the same cv-reference qualifications as the given object instance
  • typeIsMember: is_member trait detail used to deduce whether a given type is a RareTs::Member
  • filterResult: passes_filter trait detail used to get a filter if valid or a false result otherwise
  • class_t: detail used to turn a type into the the type (T::Class or Proxy<T>::Class) holding reflection details for the given type
  • is_reflected: bool trait checking whether a type is reflected
  • member_count: count of reflected members in type
  • member_type: type of the Ith member in the given type
  • member_pointer_type: type of the Ith members pointer in the given type
  • member_name: name of the Ith member in the given type
  • member_type_name: string representation of the Ith members type in the given type
  • member_pointer: value of a pointer to the Ith member in the given type
  • member_offset: value of the Ith members offset in the given type
  • member_note: value of the Ith members note in the given type
  • member_note_wrapper: type containing the Ith members note in the given type
  • member_note_type: type of the Ith members note in the given type
  • member_note_count: count of notes on the Ith member in the given type
  • memberValue(): function returning the static value of the Ith member in the given type
  • memberValue(t): function returning the instance value of the Ith member in the given type
  • member_types: tuple type containing all the types of all the members
  • member_pointer_types: tuple type containing all the pointer types of all the members
  • member_names: array containing the names of all the members
  • member_type_names: array containing the string representation of all the member types
  • member_pointers: tuple containing the values of all the member pointers
  • member_offsets: array containing the offsets of all the members
  • member_notes: tuple containing all the note-tuples of all the members
  • member_note_types: tuple type containing all the types of all the member-note-tuples
  • memberValues(): returns all the static values of all the members forwarded as a tuple
  • memberValues(t): returns all the instance values of all the members forwarded as a tuple
  • is_function: bool trait indicating whether the Ith member of the given type is a function
  • is_static: bool trait indicating whether the Ith member of the given type is static
  • class_note_count: count of class-level annotations on the given type
  • class_note: value of the Ith note within the class-level annotations on the given type
  • class_note_type: type of the Ith note within the class-level annotations on the given type
  • class_notes: value of the class-level annotations on the given type
  • class_notes_type: type of the class-level annotations on the given type
  • index_of: alias for the member index enum for the given type
  • adapt_member: adapter for the Ith member in the given object, used to make adaptive structures
  • adapt_member_type: adapter for the Ith member's type in the given object, used to make adaptive structures
  • cleanMemberValue(): similar to memberValue(), this is used in creating packs of static member values while getting more intuitive results
  • cleanMemberValue(t): similar to memberValue(t), this is used in creating packs of instance member values while getting more intuitive results
  • packMemberValues(f, is): gets a pack of static member values for members in the given index sequence "is", for the given type
  • packMemberValues(f): gets a pack of static member values for the given type
  • packMemberValues(t, f, is): gets a pack of instance member values for members in the given index sequence "is", for the given type
  • packMemberValues(t, f): gets a pack of instance member values for the given type
  • overload: class used to deduce overload properties
  • class_notes_type_defaulted: trait implementation for getting the class-level annotations type, defaulting to RareTs::NoNote if not reflected
  • class_notes_t: alias for class-level annotations on a given type which may or may not be reflected
  • MemberAnnotationsType: member detail for getting the type wrapping the value of the notes on a member
  • access_modifier: reflecting detail used in deducing the access modifier of a member
  • accessible(): reflection detail used in deducing the access modifier of a member

GlobalClass<T>

  • <T>: The type being reflected

GlobalClass is specialized for a given type "T" to reflect that type, and is automatically generated by the REFLECT_PRIVATE, REFLECT_PRIVATE_NOTED, or REFLECT_PRIVATE_EMPTY macros; a user or a 3rd-party library/reflection extension could potentially specialize GlobalClass in a pinch, though the contents are defined only by the implementation in the RareCpp reflection code.


Proxy<T>

  • <T>: The type to create a proxy for

Proxy is specialized for a given type "T", extending that same type "T", then a REFLECT or REFLECT_NOTED macro is used inside the body of the Proxy<T> specialization in order to reflect public and protected members of a type for which the REFLECT or REFLECT_NOTED macro cannot or should not be placed inside.


Reflect<T>

  • <T>: The type to access reflected information for
  • type: The type being reflected ("T")
  • IndexOf: Alias for RareTs::IndexOf<T>, used to get the index of members by their identifier
  • MemberType: Alias for RareTs::MemberType<T>, used to access a member by its identifier
  • Members: Alias for RareTs::Members<T>, interface for dealing with reflected members
  • Member<I>: Alias for RareTs::Member<T, I>, interface for dealing with a reflected member
  • Values: Alias for RareTs::Values<T>, interface for dealing with reflected members' values specifically
  • Notes: Alias for RareTs::Notes<T>, interface for dealing with class-level annotations
  • Supers: Alias for RareTs::Supers<T>, interface for dealing with super-class information

Reflect<T> is a way of accessing all the most commonly useful reflected information about a type, Reflect<T> merely holds aliases to commonly used reflection interfaces that are also accessible more directly through their types in RareTs (e.g. Reflect<T>::Members is just RareTs::Members<T>).


Members

enable_if_member_t<T>

  • <T>: The type that may or may not be a member

Used to differentiate a member filter (which can operate on all deducible properties of a member) from a member-type filter (which can only operate on a members type).


is_member<T>

<T>: The type to check

  • value: bool indicating whether the type "T" is a RareTs::Member<T, I>

Bool trait checking whether a type is a RareTs::Member or not.


member_type_tuple<T, Filter>

  • <T>: The reflected type to get the member types of
  • <Filter>: The optional member filter/predicate to apply

A type trait that gets a std::tuple of the types of the reflected members, optionally with a filter.


passes_filter<Filter, Member, Ts...>

<Filter>: The filter/predicate to apply <Member>: The member to apply the filter to <Ts...>: Any additional arguments supplied to the filter

  • value: bool indicating whether the given member passed the filter/satisfied the predicate

Bool trait checking whether a given member with the given arguments passes the filter or not.


Filter

  • None: no filter applied
  • IsData: filter for data members (raw data, pointers, references, anything that is not a function)
  • IsFunction: filter for non-overloaded function members (instance methods, static functions)
  • IsInstanceMember: filter for non-static members
  • IsStaticMember: filter for static members
  • IsInstanceData: filter for non-static data
  • IsInstanceFunction: filter for non-overloaded instance methods
  • IsStaticData: filter for static data
  • IsStaticFunction: filter for static functions
  • Is<Of>::Specialization: filter checking whether the member is a specialization of template "Of"

Some commonly used member filters, most commonly applied when using the accessor methods in RareTs::Members.


IndexOf<T>

  • <T>: The type to get the indexes of members
  • memberNames: An enum entry named the same as the member holding the index of the member
  • N_: A special enum entry indicating the total number of members

Index of can be used to get the index of a member in a reflected type "T", by its identifier. IndexOf is an alias for an enum.


Member<T, MemberIndex>

  • <T>: The type of the object in which the member resides
  • <MemberIndex>: The index of the member
  • object_type: The type of the object in which the member resides ("T")
  • type: The type of the member as it was declared in the struct/class body (decltype(T::memberIdentifier) if valid, decltype(&T::memberIdentifier) otherwise)
  • pointer_type: The pointer_type of the member (decltype(&T::memberIdentifier))
  • typeStr: A null-terminated string representation of the type of the member
  • name: The name of the member
  • index: The index of the member ("MemberIndex")
  • isStatic: Bool indicating whether this is a static member
  • isFunction: Bool indicating whether this is a non-overloaded function
  • isOverloaded: Bool indicating whether this member is overloaded (this is also true for typo'd/non-present/unsupported members)
  • isData: Bool indicating whether this member is a data-member
  • hasOffset: Bool indicating whether this member has an offset
  • getOffset(): Function returning the offset of this member
  • pointer: The member-pointer value
  • value(): Returns the static-value of the member
  • value(t): Returns the instance-value of the member within instance t
  • Overloads: Interface for accessing any known (NOTE'd) overloads of this member

Member is one of the most important structures in RareCpp, when iterating or accessing members through RareTs::Members if you are passed a member, it is an instance of this structure. This structure has no instance members/should have ~no cost to initialize and the type often needs to be taken, so it is recommended to pass by value (thus removing the need to remove the reference prior to decltype).


Members<T>

<T>: The type of the object with these members

  • total: The total number of reflected members
  • Member<MemberIndex>: Alias for RareTs::Member<T, MemberIndex> - accesses a member by constexpr index
  • member<MemberIndex>: Instance of Member<MemberIndex> - accesses a member instance by constexpr index
  • indexOf(memberName): Gets the index of a member by its identifier as a string, "memberName", constexpr friendly
  • pack(f): Passes a pack of members to the given function "f"
  • pack<Filter>(f): Passes all members that pass "Filter" to the given function "f"
  • filteredCount<Filter>(): Counts the number of members that pass "Filter"
  • forEach(f): Calls f once for each member, f may be of the form f(member) or f(member, value), the latter will only be called for statics
  • forEach<Filter>(f): Calls f once for each member that passes "Filter", f may be of the form f(member) or f(member, value), the latter will only be called for statics
  • forEach(t, f): Calls f once for each member with the value of the member on instance t, f must be of the form f(member, value)
  • forEach<Filter>(t, f): Calls f once for each member that passes "Filter" with the value of the member on instance t, f must be of the form f(member, value)
  • at(i, f): Calls f once for member at runtime index i, f may be of the form f(member) or f(member, value), the latter will only be called if member is static
  • at<Filter>(i, f): Calls f once for member at runtime index i (if said member passes "Filter"), f may be of the form f(member) or f(member, value), the latter will only be called if member is static
  • at(i, t, f): Calls f once for member at runtime index i, with the value of the member on instance t, f must be of the form f(member, value)
  • at<Filter>(i, t, f): Calls f once for member at runtime index i (if said member passes "Filter"), f must be of the form f(member, value)
  • named(name, f): Calls f once for member named "name", f may be of the form f(member) or f(member, value), the latter will only be called if member is static
  • named<Filter>(name, f): Calls f once for member named "name" (if said member passes "Filter"), f may be of the form f(member) or f(member, value), the latter will only be called if member is static
  • named(name, t, f): Calls f once for member named "name", with the value of the member on instance t, f must be of the form f(member, value)
  • named<Filter>(name, t, f): Calls f once for member named "name" (if said member passes "Filter"), f must be of the form f(member, value)

RareTs::Members<T> is perhaps the most important interface in RareCpp, allowing you to access member information on reflected objects in a variety of ways (packing, iterating, by runtime or constexpr index, by runtime or constexpr strings and applying various filters as needed) functions here often provide a "member" which is of of type RareTs::Member<T, I> where I is the member index.


MemberType<T>

  • <T>: The object type on which to get a member
  • memberNames: An alias for RareTs::Member<T, I> where I is the index of the member with the given identifier

RareTs::MemberType<T> is used to get member information using the member identifier, like RareTs::IndexOf, this is stable way to refer to members when you know what member you want to refer to at compile time (as opposed to indexes which might change when you add or remove members, or member names which might change and cause silent failures).

This can additionally be useful prototyping or debugging something you want to write using something like RareTs::Members<T>::forEach (where the member is auto'd) since when you use the strong type provided here, auto-complete/intellisense will provide additional help & convivences and you can narrow down problems (e.g. where you might need to apply filters) to a single member.


Values<T>

  • <T>: The type of the object with these member values
  • total: The total number of reflected members
  • pack(f): Passes a pack of members to the given function "f"
  • pack<Filter>(f): Passes all members that pass "Filter" to the given function "f"
  • forEach(f): Calls f once for each static member value
  • forEach<Filter>(f): Calls f once with each static member-value for members that pass "Filter"
  • forEach(t, f): Calls f once for each member-value on instance t
  • forEach<Filter>(t, f): Calls f once with each member-value on instance t for members that pass "Filter"
  • at(i, f): Calls f once with the static-member value of the member at runtime index i (if said member is static)
  • at<Filter>(i, f): Calls f once with the static-member value of the member at runtime index i (if said member is static and passes "Filter")
  • at(i, t, f): Calls f once with the member-value of the member at runtime index i on instance t
  • at<Filter>(i, t, f): Calls f once with the member-value of the member at runtime index i on instance t (if said member passes "Filter")
  • named(name, f): Calls f once for member named "name" with the static-member value (if said member is static)
  • named<Filter>(name, f): Calls f once for member named "name" with the static-member value (if said member is static and passes "Filter")
  • named(name, t, f): Calls f once for member named "name", with the value of the member on instance t
  • named<Filter>(name, t, f): Calls f once for member named "name", with the value of the member on instance t (if said member passes "Filter")

RareTs::Values<T> is very similar to RareTs::Members<T> except you're only accessing the values of members, rather than member metadata.


tuplify(t)

  • t: The reflected object to be wrapped

Returns a tuple-like type wrapping the given reflected object, providing tuple-like access to the members of the reflected object, optionally with a filter. The returned type is usable with get<I>(tup), std::get<I>(tup), std::tuple_element<I, Tup>, std::tuple_size<Tup>, structured bindings, and generic code depending on the these methods; if a reference was passed only the reference is stored; if a temporary is passed the object is moved or copied if possible. Take caution not to read after the input referenced object goes out of scope, and not to read values off of references/pointers that have gone out of scope.


Inheritance

Inherit<SubClass, Is...>

  • <SubClass>: The subclass for which you're accessing superclass information
  • <Is...>: An index sequence from 0 to total supers (automatically supplied when using the "Supers" alias)
  • SuperType<I>: The type of the Ith reflected super
  • SuperInfo<I>: All reflected information for the Ith super (type, index, notes)
  • total: The total number of reflected supers (sizeof...(Is))
  • forEach(f): Calls f once with the SuperInfo for each super
  • forEach(t, f): Calls f once with SuperInfo and t casted to SuperType as arguments
  • forEachSuper(t, f): Calls f once with t casted to SuperType as the only argument
  • at(i, f): Calls f once with SuperInfo for the ith super
  • at(i, t, f): Calls f once with SuperInfo for the ith super and t casted to SuperType as arguments
  • superAt(i, t, f): Calls f once with t casted to the ith SuperType as the only argument

The interface for accessing reflected super-class information.


NotedSuper<T, Ts...>

<T>: The type of the super <Ts...>: The types of the super-class relationships notes

  • type: The type of the super ("T")
  • notes: A tuple that stores the note values for this super-class relationship
  • Notes: A tuple type containing the types of the notes on this super-class relationship

NotedSuper is the annotation type that results when using the operator() overload on RareTs::Super (or in other-words, when you put notes on a super-class relationship). NotedSuper should not be used directly.


Super<T>

  • <T> The type of the super-class

Super<T> is a class-level annotation used to declare a super-class relationship for the class the note is attached to, to the super-class "T", notes may be added in subsequent parenthesis. Super<T> is an instance of SuperClass<T>.


SuperClass<T>

  • <T> The type of the super-class
  • type: The type of the super-class ("T")
  • notes: set to "RareTs::NoNote{}"
  • Notes: set to "RareTs::NoNote"
  • operator(notes...): Returns a NotedSuper with the given note values

The type backing the Super<T> annotation.


SuperInfo<SuperIndex, SuperType, Notes>

  • <SuperIndex>: The index of the super
  • <SuperType>: The type of the super
  • <Notes>: The notes on the super
  • type: The type of the super ("SuperType")
  • index: The index of the super ("SuperIndex")

SuperInfo is the structure passed to functions/lambdas when you use RareTs::Supers<T>, in addition to the above members SuperInfo extends the common AnnotationsType note interface.


Supers<T>

  • <T>: The type to get super-class information for

Supers is an alias for the RareTs::Inherit<T, ...> class. RareTs::Supers<T> is the primary way in which you should access super-class information for a reflected object.


⚠️ **GitHub.com Fallback** ⚠️