[Ipopt] Raw pointer from the IPOPT::SmartPtr
Stefan Vigerske
stefan at math.hu-berlin.de
Fri Mar 8 10:51:14 EST 2013
Hi,
GetRawPtr() converts a smart pointer into a usual pointer.
To get back to your derived class, you can use a dynamic_cast, e.g.,
SmartPtr<TNLP> tnlp;
DerivedClass* derivobj = dynamic_cast<DerivedClass*>(GetSmartPtr(tnlp));
assert(derivobj != NULL);
Stefan
On 03/08/2013 04:20 PM, Alex Tătulea wrote:
> Hello verybody,
>
> I hope you could help me with a hint for the following problem. I have
> extended the TNLP class with a public member (a structure) which I use to
> store additional data for my problem. And obviously I have a SmartPtr<TNLP>
> which I use to call the solver. My problem is that I would somehow like to
> acces the public member of the derived class, and that is not possible with
> this smart pointer.
>
> How could I get a pointer of the derived class type, which points to the
> same underlying object, and with which I could modify data for my problem?
>
> Thanks in advance for any tipps or ideas. Have a nice weekend!!
>
> Alex
>
>
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
>
More information about the Ipopt
mailing list