RareCpp 1.2.0 to RareCpp 2.0.0 Upgrade Guide - TheNitesWhoSay/RareCpp GitHub Wiki

A lot has changed going into RareCpp 2.0.0, so if you have code already using RareCpp you may need to make a number of changes, many of which I'll enumerate here.

If you're not ready for this upgrade you can still use the old version found here; note that in addition to the many new capabilities, RareCpp 2.0.0 boasts faster compile times and ~the same runtimes for the same operations (per -O2 testing), as well as the capacity to get better runtimes for similar activities by using packs/folds, excluding values from field/member iteration, performing more operations at compile time, etc.

General Notes:

  • All source filenames in RareCpp are now lowercase'd with underscores, and you'll find the library files in the "include/rarecpp" folder, not in RareCppLib.
  • There is no longer namespaces "ExtendedTypeSupport" and "Reflect", both type support and reflection capabilities are now in the namespace "RareTs", you should no longer need a "using namespace" anywhere, and seldom prefer using X statements.
  • What was before referred to as "Fields" are now called "Members"
  • The "simple flavor" of fields was removed entirely, while array-accessible field reflection was part of the original intent of the library, most everything doable with arrays was nigh useless, the actual types and actual values are required to do interesting things, and disparate types cannot go in arrays without type erasure/multiple hits to runtime performance.
  • While a T::Class nested structure still exists, it's heavily minimized/no longer meant to be used directly, see some of the alternatives below.

Specific Changes:

  • Replace T::Class::ForEachField or T::Class::FieldAt (or class_t::ForEachField) and similar methods with RareTs<T>::Members::forEach or RareTs<T>::Members::at
  • Replace T::Supers::ForEach and T::Supers::At (or supers_t::ForEach) and similar methods with RareTs::Supers<T>::forEach or RareTs::Supers<T>::at
  • Methods like HasAnnotation, forEachAnnotation, etc. are now hasNote, forEachNote, etc. see Notes Reflection
  • Object mapper macros MAP_TO, MAP_FROM, and MAP_WITH have been removed, preferring an approach using adaptive structures in the NOTE macro, demo'd here , and the "ObjectMapper" namespace was renamed "RareMapper".
  • ExtendedTypeSupport::TypeToStr<T>() is now RareTs::toStr<T>(), many other less-common ExtendedTypeSupport methods may have been renamed or removed, see the method listing at ExtendedTypeSupport detail documentation
  • StringBuffers (which may be deprecated in future releases, a final decision is yet to be made), if you're using them, are in the "RareBufferedStream" namespace/the "string_buffer.h" file.