DerivedQuote design

Posted by DU VIGNAUD DE VILLEFORT FRANCOIS GASAPRD PHI on
URL: http://quantlib.414.s1.nabble.com/DerivedQuote-design-tp9750.html

Hi all,

 

A quick question about the DerivedQuote class design: The operation performed by this class is a template parameter yet the actual operation is actually known only at run time. What about using a more informative template so that the operation can be known at compilation time and inlined ? (we would loose the possibility to change the operation at run time but who cares ?).

To be as explicit as possible, the DerivedQuote value method would be written like this:

 

    template <class UnaryFunction>

    inline Real DerivedQuote<UnaryFunction>::value() const {

        QL_ENSURE(isValid(), "invalid DerivedQuote");

        return UnaryFunction::eval(element_->value());

    }

 

François

 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev