So I'm trying to create some wrapper around boost.extension functions to create a class. So I created a function:
template <class BaseClass, class ConstructorType> boost::scoped_ptr<BaseClass> get_class (shared_library & lib, std::string class_name, ConstructorType value ) { map<string, factory<BaseClass, ConstructorType> > lib_factories = get_factories<BaseClass, ConstructorType>(lib); return boost::scoped_ptr<BaseClass> lib_class(lib_factories[class_name].create(value)); }
which causes:
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; cin.get(); } map<string, factory<BaseClass, ConstructorType> > lib_factories(lib_types.get()); if (lib_factories.empty()) { cerr << "Producers not found!" << endl; cin.get(); } return lib_factories; }
but the latter is not so important. What is important - I can not get my function return = (
I try like this:
boost::scoped_ptr<PublicProducerPrototype> producer = get_class<PublicProducerPrototype, int>(simple_producer, "simpleProducer", 1);
I also tried:
boost::scoped_ptr<PublicProducerPrototype> producer ( get_class<PublicProducerPrototype, int>(simple_producer, "simpleProducer", 1));
but the compiler changes t C2248 , it cannot call some private member boost::scoped_ptr<T>
So how to make my return ... returnable // how to get it?
Rella source share