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! |
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 ------------------------------------------------------------------------------ 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 |
Muchas gracias - that worked today (but it did not last night - which was admittedly a long day!)
|
Free forum by Nabble | Edit this page |