July 29th, 2010, 4:58 am
The easiest way would be a a simple static std::map defined in your CPP file before all functions are declared. Say it contains yield curves.std::map<string,YieldCurve>. After creating the yield curve, you can assign a unique ID to it and store it in the map. You'd return thestring. In some other function, say getDiscount(std::string id, int date) you could look up the id and the corresponding YieldCurve and return whatever you like. That's the easiest way. Now, you wouldn't want a map for each different object. So, you could create a generalrepository class using the Singleton pattern (I'm using boost::any+boost:: optional) for that.
Last edited by
Leonidas on July 28th, 2010, 10:00 pm, edited 1 time in total.