J
Jonathan Lee
I've been trying to find a way to enable templates for a class based
on
whether or not that class has a member function. So far, all the
examples
I can find are if class T has member "known_name". But I'm sorta
looking
for the opposite: if some known class has an overloaded member
function.
Any ideas on this? I'm not very good with these enable_if type
things...
As a concrete example, suppose I have
class BigInt {
public:
BigInt& operator+=(unsigned long);
BigInt& operator+=(long);
};
and I want to enable operator+(const BigInt&, T) if BigInt:
perator
+=(T)
exists (so, for unsigned long and long, but not int or unsigned int in
this
example).
Thanks
--Jonathan
on
whether or not that class has a member function. So far, all the
examples
I can find are if class T has member "known_name". But I'm sorta
looking
for the opposite: if some known class has an overloaded member
function.
Any ideas on this? I'm not very good with these enable_if type
things...
As a concrete example, suppose I have
class BigInt {
public:
BigInt& operator+=(unsigned long);
BigInt& operator+=(long);
};
and I want to enable operator+(const BigInt&, T) if BigInt:
+=(T)
exists (so, for unsigned long and long, but not int or unsigned int in
this
example).
Thanks
--Jonathan