1.3. Overview: Features & Limitations - TheNitesWhoSay/RareCpp GitHub Wiki

Features

Reflect

  • REFLECT classes and up to 125 class members
  • REFLECT from inside the class definition
  • REFLECT from outside the class definition*
  • REFLECT static & non-static members
  • REFLECT data members
  • REFLECT reference members
  • REFLECT functions
  • REFLECT overloaded-functions
  • REFLECT super-classes
  • REFLECT templated-classes
  • REFLECT templated-members**

* Reflection from outside the class definition can be done on public and protected members - or - with more limitations than the in-class macro, on private members.

** Any members based on the class-level template parameters and any functions for which template parameters are inferred from parameters are reflectable, reflecting other templated members is not always possible.

Annotate

  • NOTE classes, members, super-classes and overloads to tag them with additional compile-time information
  • NOTE using any data available in constexpr, user-defined or library-specific
  • Common interface to check for note-of-type presence and get note values on particular members/classes/supers/overloads
  • Common interface to filter and iterate notes on particular members/classes/supers/overloads

Member Information

  • Iterate members
  • Access members by constexpr index
  • Access members by runtime index
  • Access members by name string
  • Access members by identifier
  • Get member static value, instance value, type, pointer type, name, index, staticness, access-protection modifier, offset, and overloads

Access supers

  • In lambda loops
  • By constexpr index
  • By runtime index

Extensions

  • Adaptive Structures (dynamically create structures consisting of one some combination/subset of one or more classes members)
  • RareBuilder - Type-safe, adaptive-struct-based builder implementation
  • RareMapper - Reflection-based object mapper
  • RareJson - JSON I/O for reflected structures

Limitations

C++ Version

  • C++17 and up required

Supported Compilers

RareCpp minimizes use of compiler-specific features wherever possible, other compilers may work without modification and may or may not be possible to add to supported compilers upon request.

Use of compiler versions lower than preferred may disable or cause bugs with certain features.

  • GCC Minimum: 10.1 (10.3.0 and up preferred)
  • Clang Minimum: 9.0.0 (15.0.0 and up preferred)
  • MSVC Minimum: 19.26 (MSVC 19.29/Visual Studios 2019 version 16.11.2 and up preferred)

Known Compiler Issues

  • Unable to use the REFLECT macro in non-public sections in GCC versions before 12, recommended to use public sections for the REFLECT macro until GCC 12 has wider support & adoption
  • MSVC 1932 (Visual Studio 2022 version 17.2.2) and up is required to accurately detect the access-protection level of protected members

Known General Limitations

  • Cannot currently reflect type alias-members
  • Cannot currently reflect the relationship between parent and nested classes (nested classes themselves can be reflected)
  • Cannot currently detect the access-protection level of overloads (they will default to private)
  • Cannot currently reflect all template members (cannot reflect templated data members not-based on class-level template parameters nor templated functions with parameters that can't be deduced from function parameters)