0
如何從這樣的功能接收map<string, factory<BaseClass, ConstructorType> >
?如何接收地圖<A, B>&從函數/類?
所以我
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)