|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-10-31 22:35:45
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
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk