Copy issues
Posted by Stefano Portolan on
URL: http://quantlib.414.s1.nabble.com/Copy-issues-tp16026.html
Hello to everybody,
I would like to throw kind of a general question.
I am bootstrapping my discounting and forwarding curves in order to price something (let's say a swaps as in QuantLib example). If I have instanciated a PiecewiseYieldCurve class and have it stored either as a pointer (boost::shared_ptr<QuantLib::YieldTermStructure> ( new QuantLib::PiecewiseYieldCurve<QuantLib::Discount,QuantLib::Cubic>( etc... )) or as the class itself, can I safely copy it in the case I want to change a pillar and compare the old with the new result?
I guess that if I use the operator= or the copy constructor I should perform a shallow copy only.
Am I wrong?
Does anyone has ever though of how to perform a complete deep copy of it?
More troublesome.
If I bootstrap within a multi-curve framework I can give the RateHelper the discounting curve as an input parameter of its constructor. Ok, but this is a Handle, which means that if I copy the RateHelper I am copy the Handle and not the resource the Handle is pointing to. Right?
Thanks in advance for sharing your knowledge.
Best.
Stefano