Re: template parameters not deducible in partial specialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18 November 2016 at 14:20, Leseratte wrote:
> Hello,
>
> i have a base template class like this:
>
> template<uint8_t num, typename T> class A { ... }
>
> and I want to place the implementation differences in specialized templates
> like this:
>
> template<uint8_t num, typename T> class A<0, uint8_t> { ... }
> template<uint8_t num, typename T> class A<1, uint16_t> { ... }
> template<uint8_t num, typename T> class A<2, uint8_t> { ... }
>
> I use compiler from trunk compiled for target avr and I get the error:
>
> sample.h:291:15: error: template parameters not deducible in partial
> specialization:
>          class A<0, uint8_t>
>                ^~~~~~~~~~~~~~~~~
> sample.h:291:15: note:         'num'
> sample.h:291:15: note:         'T'
>
>
> I read that template with different integer values should work, so what's my
> fault?

Your syntax is wrong (so it's not a GCC problem, and you should take
any further questions to a general C++ forum).

When you specialize a template argument it doesn't appear in the
parameter list, i.e.

template<> class A<0, uint8_t> { ... }



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux