Link to home
Start Free TrialLog in
Avatar of Unimatrix_001
Unimatrix_001Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Partial template specialization issues

Hello.

Is there anyway for me to accomplish something as follows where the specialised template is only specialised for a number of parameters (in this case 1), rather than them all?

Thanks,
Uni
template<typename TA, typename TB=int>
class CClass{
};
 
template<>
class CClass<typename TA, double>{
};

Open in new window

Avatar of Let_Me_Be
Let_Me_Be
Flag of United States of America image

Yes, but only in the opposite direction (left to right).
template < typename A, typename B >
class SomeClass
{
    A a;
    B b;
};
 
template < typename B >
class SomeClass<int,B>
{
    int a;
    B b;
};

Open in new window

Avatar of Unimatrix_001

ASKER

Yeugh... this template business just keeps getting uglier every turn! :(
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ack - accepted too early... jrk mind opening this question please?
Yes if you wouldn't mind. Thanks.
Sorry for the confusion :)

For some reason I had really stored in my memory that you have to do partial specialization from left to right (and I can't figure out why).
LMB, don't let it worry you. ;) Not a problem at all.

Uni.
...and closed again! ;)
Cheers.