On 16 Srp, 16:04, Frank Birbacher <bloodymir.c...@gmx.net> wrote:
> Hi!
>
> Ondra Holub schrieb:
>
> > On 16 Srp, 14:48, Frank Birbacher <bloodymir.c...@gmx.net> wrote:
> >> //generic
> >> template<typename T>
> >> void process(T t) {}
>
> >> //partial specialization
> >> template<typename T>
> >> void process(T* const t) {}
>
> Is the above really a "full specialization"? o_O
Well, you're right, I missed this one in the middle :-)
>
> > Yes. it works. But it is full specialization, not partial
> > specialization. Try following:
>
> > template<typename T, int N>
> > void Func()
> > {
> > }
>
> > template<typename T>
> > void Func<T, 10>()
> > {
> > }
>
> -.- ok, fails. But why? I don't understand this restriction, especially
> because classes can be partially specialized.
>
> Frank
I do not understand it too, but this is current situation :-( I
usually use workaround with static class member which works, although
it looks not as good as simple function:
template<typename T, int N>
class X
{
static void Func() { }
};
template<typename T>
class X<T, 10>
{
void Func<T, 10>() { }
};
Maybe we'll have to wait for a new standard... And then it will depend
on supplier of our compiler :-)