Re: template class specialization trouble
Road Dog <noone@nowhere.com> writes:
template <typename A, typename B, typename C>
class D
{
};
template <typename A, typename C>
class D<A, void, C>
{
};
template <typename A, typename B, void (A::*MF)(B)>
class D
{
};
template <typename A, void (A::*MF)()>
class D<A, void, MF>
class D
{
};
produces:
test4.cc:17: error: invalid parameter type 'void'
test4.cc:12: error: in declaration 'template<class T, class W, void
(T::* MF)(W)> struct Whatever'
test4.cc:17: error: '<type error>' is not a valid type for a template
constant parameter
[It's always a bit irritating if people don't post the code that they
have tested. The code you posted contains an obvious typo, and the
parameters on (what the gcc error messages call) line 12 don't match
the code.]
Try this:
template <typename A, typename B>
class D<A, B, void (A::*)(B)>
{
};
template <typename A>
class D<A, void, void (A::*)()>
{
};
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]