Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2000-11-01 13:25:36


> A big disadvantage of
> using function template specialization is that the most obvious syntax to
> use makes it order-dependent:
>
> template <class T> void f(T); // #1
> template <> void f<int*>(int*); // #2
> template <class T> void f(T*); // #3
>
> #2 specializes #1, but:
>
> template <class T> void f(T); // #1
> template <class T> void f(T*); // #3
> template <> void f<int*>(int*); // #2
>
> Now #2 specializes #3.
>
That makes no sense.
template<class T> class f{}; // #1
template<> class f<int *> {}; // #2
template<class T> class f<T *> {}; // #3

for f<int *> isn't #2 more specialized than #3? And if
it works this way for classes, why wouldn't it work that
way for functions?

  -gary-

gary.powell_at_[hidden]


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