Boost logo

Boost Users :

From: Nat Goodspeed (nat_at_[hidden])
Date: 2007-09-27 22:44:44


Diego Bernini wrote:

> see these lines:
>
> boost::shared_ptr<Executor> executor(&(createExecutor(subclass,name)));
> if(!executor) {
> throw LoadingClassException("createExecutor function
> of\""+subclass+"\" return null.");
> }
> //executor points to an object of class ExecDebugger that IS A Executor
> //(it's a plugin loaded at run time via Qt)
>
> boost::shared_ptr<Nameable> a=executor;
> boost::shared_ptr<Executor> sp;
>
> sp=boost::dynamic_pointer_cast<Executor>(a);

Please post a minimal complete example we could compile? I must confess
I don't quite understand the class hierarchy you have in mind.

I also don't understand the first line. If the return type of
createExecutor() is Executor*, why are you taking the address of the
returned value with & ? Wouldn't that produce an Executor**? But if the
return type of createExecutor() is Executor, aren't you taking the
address of a temporary object that will be destroyed?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net