This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: template parameters not deducible in partial specialization
- From: Leseratte <bookreader at gmx dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 19 Nov 2016 09:59:45 +0100
- Subject: Re: template parameters not deducible in partial specialization
- Authentication-results: sourceware.org; auth=none
- References: <2347260.mKGarxdDCs@django19> <3958557.x8MsqxzBcN@django19> <CAH6eHdThBahTYFQyBDKS8R5AUVM4YG7W1U=RfP6ifPX-cNikgA@mail.gmail.com>
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.