template parameters not deducible in partial specialization

Leseratte bookreader@gmx.com
Sat Nov 19 05:09:00 GMT 2016


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.



More information about the Gcc-help mailing list