|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-05-12 20:38:30
"Thorsten Ottosen" <nesotto_at_[hidden]> writes:
> | You can try it with
> |
> | template<class T> void begin( MyType<T> & t );
> |
> | and see that it will fail in a similar way. Also try
> |
> | template<class T> void begin( T & t );
> |
> | to see that it will succeed and deduce T as MyType<int> const.
> |
> | HTH.
>
> hm..you learn something new every day; I wasn't aware of the difference
> between T& and UDT<T>&
It's not really a difference.
With
template <class T>
void f(T&);
T can be deduced as anything, including const U for some U.
With
template <class T>
void f(something<T>&);
again T can be deduced as anything, including const U for some U. But
there's no leeway to magically insert a const after "something<T>",
where there's no type parameter.
-- Dave Abrahams Boost Consulting 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