LazyObject quick question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

LazyObject quick question

Kakhkhor Abdijalilov
Hi everyone.
Can someone tell me if this code fragment is well defined and
efficient in QuantLib for all instruments?

std::cout << someInstrument.NVP() << '\t' << someInstrument.errorEstimate();

I am 95% confident that it is well defined for all instruments
(assuming that error estimate is applicable) and doesn't trigger
double calculation (thanks to LazyObject).

Thank you in advance,
KA.

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: LazyObject quick question

Luigi Ballabio
On Thu, 2010-08-05 at 06:27 -0500, Kakhkhor Abdijalilov wrote:
> Can someone tell me if this code fragment is well defined and
> efficient in QuantLib for all instruments?
>
> std::cout << someInstrument.NVP() << '\t' << someInstrument.errorEstimate();
>
> I am 95% confident that it is well defined for all instruments
> (assuming that error estimate is applicable) and doesn't trigger
> double calculation (thanks to LazyObject).

I'm 95% confident too.  No, make it 99%.  It works as you want as long
as one doesn't implement an instrument and overrides its machinery. I
don't think there's any such instrument in the library.

Luigi


--

What is written without effort is, in general, read without pleasure.
-- Samuel Johnson



------------------------------------------------------------------------------
This SF.net email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users