I was wondering how can I create an object if type of this object is stored in a string. My goal is to optimise it as good as it's possible, this algorithm will be iterated many times. I know 3 possible solutions:
- Creating a list (vector?) of possible classes and iterating over all possible variants (slow as hell if i have >10 possible classes)
- std::map approach (creating a map and checking all of it) (performance not checked)
- Using Boost::PFR (kind of "reflection" library for C++) (performance also not known)
Do you know which approach would be the best and fastest options? And how to implement that? Sincerely, Karol
Aucun commentaire:
Enregistrer un commentaire