rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.18k stars 441 forks source link

Obtain list of all registered classes #326

Open spkansas opened 2 years ago

spkansas commented 2 years ago

For the life of me, I cannot find a solution to obtain a list of explicitly registered classes. GetTypes() obtains a list of far more than I am looking for -- is there a way to filter or alternative approach?

ken-noland commented 2 years ago

okay, so the way I went about doing this isn't the most optimal, but finally got me moving forward. I created my own wrapper for the registration and then I inserted a metadata tag on each of the datatypes I have personally registered. This way, when iterating over types, I can clearly extract the ones(by using the metadata) I care about and ignore all the core C++ and std:: types.

SeanOMik commented 1 year ago

You can just check the names of the types and remove/skip the ones that start with std:: or rttr::. That's what I did and it works great.