template parameters not deducible in partial specialization

Jonathan Wakely jwakely.gcc@gmail.com
Sat Nov 19 08:51:00 GMT 2016


On 19 November 2016 at 05:08, Leseratte  wrote:
> Am Fr 18. Nov 2016, 18:18:47 schrieb Jonathan Wakely:
>> On 18 November 2016 at 14:20, Leseratte wrote:
>> > 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> { ... }
>>
>> Your syntax is wrong ...
>> template<> class A<0, uint8_t> { ... }
>
> OK, that was my first try, but with that specialization neither num nor T is
> known in the specialization, wich gives me bunch of errors, like:
>
> error: 'T' does not name a type: did you mean '...
>
> Well, to be more precise: nothing of the general definition is known at
> specialization time.

Yes, that's how C++ works.



More information about the Gcc-help mailing list