Boost logo

Boost :

Subject: Re: [boost] Library design Q : overloads v/s default args
From: David Abrahams (dave_at_[hidden])
Date: 2010-06-20 06:38:49


At Sun, 20 Jun 2010 12:17:43 +0200,
Stefan Strasser wrote:
>
> Zitat von Roshan <roshan_naik_at_[hidden]>:
> > template<class Itr, class T, class BinOp>
> > accumulate(Itr first, Itr last, T init, BinOp op = std::plus<T>() );
> >
> >
> > I am wondering if there is any reason to avoid default arguments in
> > general purpose libraries ?
>
> this case won't compile, template arguments are not deduced from
> default arguments.

A problem, incidentally, that can be solved using Boost.Parameter.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk