I have a C++ pure virtual base class/ interface with several implementations which are defined in different places in the code, and other implementations may be added later. I need a way to register the available implementations, read in (from a configuration file, user input, etc) which implementation of the interface to use, and then construct an instance of that implementation.
How can I do this in a general way (ie, table driven, not with a switch/ case statement that lists each one of implementations explicitly)? I'm having trouble figuring how to go from a runtime value indicating the type to a compile time type that I can instantiate.
Does boost have anything like this?