如何map<string, factory<BaseClass, ConstructorType> >
从这样的功能中接收?
所以我有
template <class BaseClass, class ConstructorType>
map<string, factory<BaseClass, ConstructorType> > get_factories (shared_library & lib) {
type_map lib_types;
if (!lib.call(lib_types)) {
cerr << "Types map not found!" << endl;
}
map<string, factory<BaseClass, ConstructorType> >& lib_factories(lib_types.get());
if (lib_factories.empty()) {
cerr << "Producers not found!" << endl;
}
return lib_factories;
}
我尝试通过以下方式获得它的价值:
map<string, factory<PublicProducerPrototype, int> > producer_factories();
producer_factories = get_factories<PublicProducerPrototype, int>(simple_producer);
我尝试为自己概括/简化一些 boost.extension 方法。
那么如何map<A, B>&
正确接收呢?
如何正确初始化链接或如何返回不是链接而是真实对象?(对不起 C++ nube)