|
From: Luigi B. <lui...@gm...> - 2010-02-23 08:57:13
|
On Mon, 2010-02-22 at 20:05 +0100, Ferdinando Ametrano wrote: > On Mon, Feb 22, 2010 at 9:36 AM, Luigi Ballabio > <lui...@gm...> wrote: > > Try using reverse iterators. > > following your suggestion I found out a bug in the previousAmount and > previousRate functions, which was easily fixed switching to reverse > iterator (please find the patch below). > > Unfortunately the fix is not backward compatible as it requires > CashFlows::previousCashFlow and BondFunctions::previousCashFlow to > return a Leg::const_reverse_iterator instead of Leg::const_iterator. Well, it doesn't strictly require it---you could retrieve the iterator from the reverse iterator. But I see that the common use case would be to turn it into a reverse itereator again, so it makes more sense to change the signature. <sigh> Ok, I'm applying it. Commit the thing on the trunk asap. Luigi -- Do the right thing. It will gratify some people and astonish the rest. -- Mark Twain |