Posted by
Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/default-0-Days-value-for-Period-in-QLXL-tp13153p13154.html
On Mon, 2009-10-12 at 16:42 +0200, Ferdinando Ametrano wrote:
> I could provide a non-explicit string constructor for
> QuantLib::Period(std::string s) as solution, but something tells me
> Luigi might frown at this (or God forbid, even balk at this ;-)
At the very least, I'd raise an eyebrow :)
Would it be feasible to use a little adapter class in QLA? Something
like:
class QlaPeriod {
QuantLib::Period p_;
public:
// input in as many ways as you like...
QlaPeriod(QuantLib::Period p) : p_(p) {}
QlaPeriod(std::string s) : p_(PeriodParser::parse(s)) {}
// ...then pass it wherever a period is needed:
operator QuantLib::Period() const { return p_; }
};
Your various ObjectHandler::convert2 functions would return QlaPeriods
and the underlying functions would accept them after the automatic
conversion.
Luigi
P.S. On a related note, how about the hideous 0*Years vs 0*Days thing?
I'm still shaking from that one :)
--
I'd never join any club that would have the likes of me as a member.
-- Groucho Marx
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev