Re: [QuantLib-svn] SF.net SVN: quantlib: [11763] trunk/QuantLib/ql/index.hpp

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Re-QuantLib-svn-SF-net-SVN-quantlib-11763-trunk-QuantLib-ql-index-hpp-tp9607p9609.html

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