
20 Jun
2010
20 Jun
'10
9:11 a.m.
Hope this is not a silly question. The C++ Standard library does not use default arguments. Instead it provides an additional overload. Anybody know why ? For e.g. It provides the following two overloads for accumulate : template<class Itr, class T> accumulate(Itr first, Itr last, T init); template<class Itr, class T, class BinOp> accumulate(Itr first, Itr last, T init, BinOp op); instead of: 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 ? - Roshan