B
bluekite2000
Here is the code:
#include <iostream>
#include <vector>
#include <complex>
typedef std::complex<double> CD;
typedef std::complex<float> CS;
using std::vector;
template<typename T1,typename T2>
vector<T2> abso(const vector<T1>& Vin)
{
vector<T2> Vout(Vin.size());
for(int i=0;i<Vin.size();i++)
Vout=abs(Vin);
}
int main(void)
{
vector<CS> Vin(3,2);
vector<float> Vout=abso(Vin);
return 0;
}
The error is:
error: no matching function for call to `abso(std::vector<CS,
std::allocator<CS> >&)'
#include <iostream>
#include <vector>
#include <complex>
typedef std::complex<double> CD;
typedef std::complex<float> CS;
using std::vector;
template<typename T1,typename T2>
vector<T2> abso(const vector<T1>& Vin)
{
vector<T2> Vout(Vin.size());
for(int i=0;i<Vin.size();i++)
Vout=abs(Vin);
}
int main(void)
{
vector<CS> Vin(3,2);
vector<float> Vout=abso(Vin);
return 0;
}
The error is:
error: no matching function for call to `abso(std::vector<CS,
std::allocator<CS> >&)'