Handle class conversion. Open discussion.

Posted by Kakhkhor Abdijalilov on
URL: http://quantlib.414.s1.nabble.com/Handle-class-conversion-Open-discussion-tp8938.html

Dear all,
Current implementation of Handle class doesn't permit conversion from
Handle<Derived> to Handle<Base>. If we supply Handle<Base> with
converting constructor, an instance of Handle<Derived> could be
substituted where an instance of Handle<Base> is expected. For
example, an instance of Handle<SimpleQuote> could be passed  to term
structure constructors instead of Handle<Quote> instance. This
conversion makes sense, since SimpleQuote is a subtype of Quote.

Enabling conversion would allow user code use derived class features
without a need for dynamic casting. Safety of conversion can be
checked at runtime, similar to pointer down-casting.

I did some coding in this direction and so far everything looks OK.
Since it is a design decision and not a bug fix, I wanted to know what
other think before submitting my code.

Regards,
Kakhkhor Abdijalilov.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev