Re: Wrapping QuantLib::VanillaSwap class
Posted by
Luigi Ballabio on
Mar 31, 2017; 8:50am
URL: http://quantlib.414.s1.nabble.com/Wrapping-QuantLib-VanillaSwap-class-tp18163p18164.html
That would be
qlSwap = boost::shared_ptr<VanillaSwap>(new VanillaSwap(swapType, nominal, ... floatingLegDayCounter));
Luigi
On Fri, Mar 31, 2017 at 10:41 AM Raj Subramani <
[hidden email]> wrote:
I have to maintain dimensions such as tradeid, counterpartyname and various
other parameters. I have therefore created a class called
PlainVanillaSpotSwap with the header file - as follows:
PlainVanillaSpotSwap.h
class PlainVanillaSpotSwap
{
private:
std::string _tradeid;
...
...
public:
...
boost::shared_ptr<VanillaSwap> qlSwap;
}
My problem is I do not know how to lazy instantiate this shared pointer
called qlSwap.
At the moment inside the constructor for PlainVanillaSpotSwap - I am doing
boost::shared_ptr<VanillaSwap> _qlSwap(new VanillaSwap(swapType, nominal,
... floatingLegDayCounter));
Obviously - _qlSwap is a local VanillaSwap object created inside the
constructor and then I set
qlSwap = _qlSwap;
I would like to avoid this and initialize qlSwap in the constructor itself.
Its been a while since I coded in C++ so please be gentle!
--
View this message in context: http://quantlib.10058.n7.nabble.com/Wrapping-QuantLib-VanillaSwap-class-tp18163.html
Sent from the quantlib-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org!
http://sdm.link/slashdot_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users