Hello I have the following situation.
I'm using c++14, and I have several classes whose objects are serialized via JSON objects. In order to determine the class of the object the JSON file represents, the JSON has a className field, which maps to a string of the classname for example:
{
...,
className: "class_one",
...,
}
Instead of comparing each string to each available class I would like to do use a hash-table, std::unordered_map. The problem is I would need to manually create a hash-table that has all the class mapping of strings to the proper initialization functions for each class (all the classes inherit from the same super class here). I would like to instead do a compile time creation of this table and add new entries based on each new class that inherits from the super class I mentioned earlier. Is this possible?