On Sun, 2007-07-01 at 09:47 -0700, [hidden email] wrote:
> Revision: 11763 > http://quantlib.svn.sourceforge.net/quantlib/?rev=11763&view=rev > Author: nando > Date: 2007-07-01 09:47:02 -0700 (Sun, 01 Jul 2007) > > Log Message: > ----------- > addFixings std::vector safe (size checked) specialization > @@ -63,6 +63,12 @@ > /*! the dates passed as arguments must be the actual calendar > dates of the fixings; no settlement days must be used. > */ > + void addFixings(const std::vector<Date>& dates, > + const std::vector<Real>& values); > + //! stores historical fixings at the given dates > + /*! the dates passed as arguments must be the actual calendar > + dates of the fixings; no settlement days must be used. > + */ > template <class DateIterator, class ValueIterator> > void addFixings(DateIterator dBegin, DateIterator dEnd, > ValueIterator vBegin) { Did we really need it? We could use the method taking iterators. Luigi -- This gubblick contains many nonsklarkish English flutzpahs, but the overall pluggandisp can be glorked from context. -- David Moser ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On 7/2/07, Luigi Ballabio <[hidden email]> wrote:
> > + void addFixings(const std::vector<Date>& dates, > > + const std::vector<Real>& values); > > template <class DateIterator, class ValueIterator> > > void addFixings(DateIterator dBegin, DateIterator dEnd, > > ValueIterator vBegin) { > > Did we really need it? We could use the method taking iterators. the implementation of addFixings(const std::vector<Date>&, const std::vector<Real>&) is actually just performing a size check and then calls the iterator version. I provided this a tiny wrapper because 99% of problems we've been having with Indexes were about adding fixings using vectors of different sizes, and in some instance such problems were hard to detect (e.g. when values was shorter then dates) ciao -- Nando ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Mon, 2007-07-09 at 21:35 +0200, Ferdinando Ametrano wrote:
> On 7/2/07, Luigi Ballabio <[hidden email]> wrote: > > > + void addFixings(const std::vector<Date>& dates, > > > + const std::vector<Real>& values); > > > template <class DateIterator, class ValueIterator> > > > void addFixings(DateIterator dBegin, DateIterator dEnd, > > > ValueIterator vBegin) { > > > > Did we really need it? We could use the method taking iterators. > > the implementation of addFixings(const std::vector<Date>&, const > std::vector<Real>&) is actually just performing a size check and then > calls the iterator version. Yes, but the problem is that after having taken some pains to write the function in a general way, we go and lose a lot of generality for the purpose of the check. Why not addFixings(vector<pair<Date,Real> >), or map<Date,Real>, or TimeSeries<Real>? You're basically forcing the user to choose your preferred container in order to have the additional check. Or if not "forcing", at least "strongly suggesting." I'd leave him (or her) more freedom. Sure, the check is useful, but it can be performed at the application level when one instantiates the actual types whose iterators will be used. Later, Luigi -- All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can't get them together again, there must be a reason. By all means, do not use a hammer. -- IBM maintenance manual, 1925 ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |