template parameters not deducible in partial specialization
Leseratte
bookreader@gmx.com
Sat Nov 19 08:59:00 GMT 2016
Am Sa 19. Nov 2016, 08:51:24 schrieb Jonathan Wakely:
> 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.
Oups - didn't know that.
Ok - thank you for your support!
I created a base class for the common stuff and it works now.
More information about the Gcc-help
mailing list