P
PengYu.UT
Hi,
In the function body of doit, I want to assign -x to _a if x is a real
type. I want to assign conj(x) to _a if it is a complex type.
I could define
template <typename T>
class A<std::complex<T> > {
.....
};
But there are some redundancies between the definition class
A<std::complex<T> > and class A<T>.
I'm wondering if boost MPL can be without define a new class or the
class with a different template parameters.
Thanks,
Peng
template <typename T>
class A {
public:
A() {}
void doit(const T &x) {
....
}
private:
T _a;
};
int main() {
A<double> a;
double x = 0;
a.doit(x);
}
In the function body of doit, I want to assign -x to _a if x is a real
type. I want to assign conj(x) to _a if it is a complex type.
I could define
template <typename T>
class A<std::complex<T> > {
.....
};
But there are some redundancies between the definition class
A<std::complex<T> > and class A<T>.
I'm wondering if boost MPL can be without define a new class or the
class with a different template parameters.
Thanks,
Peng
template <typename T>
class A {
public:
A() {}
void doit(const T &x) {
....
}
private:
T _a;
};
int main() {
A<double> a;
double x = 0;
a.doit(x);
}