Login  Register

Re: small improvements

Posted by Kakhkhor Abdijalilov on Jul 12, 2010; 8:47pm
URL: http://quantlib.414.s1.nabble.com/small-improvements-tp13335p13337.html

>> 1.    generalstatistics.hpp
>>        In reset()  method use "the swap trick" to reset the vector of
>> samples. The assignment
>>         of an empty vector doesn't free the storage. (Item 17 in
>> "Effective STL").

>I'm not sure about that.  It's likely that after a reset(), we'll start
>adding new samples, in which case the storage will save us an
>allocation.

Agree. The storage can be reused later. In that case, we could simply
use vector's clear method instead of assigning an empty vector.


>We should define P though. Do you care to give it a try?
I would, but never used doxygen before.


>> 5.    instrument.hpp
>>       "virtual" can be omitted from the declaration of 'performCalculations'.

>No, that's intentional.  We wanted to leave it virtual so that one can
>override the engine mechanism if needed.

It is not a bug, but more like pedantic adherence to the coding style.
performCalculations is declared virtual in LazyObject. We could drop
the keyword virtual when overwriting performCalculations in
Instrument, just like we drop the keyword virtual when overwriting all
other virtual methods in derived classes.


Regards,
Kakhkhor Abdijalilov.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev