I am currently struggling with templates: I have a templated class A
, which performs basic math (for floats, doubles, complex numbers) and looks like this
template <typename T>
class A
{
public:
void foo(std::vector<std::complex<T>>& result);
};
Now I can use the class like A<double>, A<float>
, but I would also like to use it like A<std::complex<float>>
and A<std::complex<double>>
. When using the latter, I would like the definition of foo
to look like
void foo(std::vector<std::complex<float>>& result);
and not like
void foo(std::vector<std::complex<std::complex<float>>>& result);
Is there any way to create a specific template for the std::complex<T>
cases, in which I can access the "inner" type? Or this is not possible/bad practice?
What is the most elegant way to solve this issue?