For 4th, 5th and 6th parameters I have declared arrays and constructor expects vector so I am passing as above. |
An array is not the same thing as a vector. If it expects a vector, you have to pass a vector.
|
RemezFilterDesign::remez(&(m_impluseResponse[0]), numtaps, numband, &(bands[0]), &(des[0]), &(weight[0]), type, griddensity);
|
bands
is a vector (of int? I assume a
vector<int>
).
bands[0]
is the first element.
&(bands[0])
is a pointer to the first element. You are NOT passing a vector. You are passing a int*.
In C++, when you pass an array, you're really passing a pointer to the first element. So that's why it works in this case; because the function expects a pointer, and you're passing a pointer. To summarise:
|
RemezFilterDesign::remez(&(m_impluseResponse[0]), numtaps, numband, &(bands[0]), &(des[0]), &(weight[0]), type, griddensity);
|
Here, you are NOT passing any vectors. The function expects a pointer, and you are passing it a pointer to the first element in the array. You're not passing a vector. You're passing a pointer.
Here m_m_impluseResponse, bands, des and weights are all vectors but function expects arrays but here I get no error. so why for the constructor? |
Again, to make it really clear, you are NOT passing vectors here. The function expects pointers (arrays), you're passing pointers, all happy.
In the constructor call, it expects vectors and you're passing pointers, so it fails.