|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-06-22 07:40:57
Noel Yap <Noel.Yap_at_[hidden]> writes:
> Is there any particular reason why at least some boost code uses
> default parameters. IME, I've found the using overloading is
> preferable. For example, when using boost::bind, one would have to
> explicitly give the default parameters whereas one wouldn't
> if overloading were used.
Sometimes the code is much easier to write with default parameters
than with overloading.
> Also, using overloading rather than default parameters when a new
> function interface is needed can potentially break less client code
> (eg code that uses the type of the function won't break if
> overloading were used).
Correct.
> Given this, I'd like to hear some arguments for using default
> arguments over overloading (outside of constructors, of course, where
> one may not have much of a choice).
I don't see why ctors are different from anything else, other than
when using enable_if.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net