Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-11-01 01:17:24


Douglas Gregor <gregod_at_[hidden]> writes:

> On Thursday 31 October 2002 09:07 pm, David Abrahams wrote:
> > Douglas Gregor <gregod_at_[hidden]> writes:
> > > template<typename T> void foo(const T&)
> > >
> > > ?
> >
> > Yes.
> >
> > > I ask because this would have different semantics than:
> > >
> > > template<typename T> void foo(T);
> > >
> > > when passed a function (because there is no reference to const function).
> >
> > In general users are prohibited from taking the address of standard
> > library functions, because the implementor is free to add undocumented
> > default arguments and overloads. I think the same should apply to
> > boost.
>
> I was thinking of:
>
> template<typename T> void foo(const T&);
> int bar(int, int);
> int main() { foo(bar); } // error: can't form reference to const function

Good point. I guess C++ is not quite as Fun as I thought ;->

-- 
                    David Abrahams
dave_at_[hidden] * http://www.boost-consulting.com

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