
Peter Dimov wrote:
given a string from a file or a script, I need to instantiate a distinct C++ class corresponding to that string.
Typically you'll have something like
std::map< std::string, boost::function<std::auto_ptr<A>()> > s_factory;
where A is your abstract base, and initialize s_factory with
s_factory[ "X" ] = boost::factory< std::auto_ptr<X> >();
Thanks. That resembles what I built myself. I'd still like to see something very like this in the documentation examples. I may still be missing opportunities for compile-time polymorphism, and perhaps it's true that including machinery like the above as part of an expanded Boost library would unnecessarily constrain the uses of the existing library. I'd like to see examples of some of those other uses, too.