2Dベクトルがあり、十分な値を含まないブロックを削除する必要があります。
typedef vector<double> iniMatrix;
bool hasInsufficientEnergy() {
return true;
}
vector<double> Audio::filter(vector<iniMatrix>&blocks, double sumThres, double ZeroThres)
{
vector<double> totalEnergy;
vector<double> totalZeroCross;
double totalSum = sumThres * blocks.size();
double totalZero = ZeroThres * blocks.size();
vector<iniMatrix> blockked;
for(unsigned i=0; (i < blocks.size()); i++)
{
totalEnergy.push_back(abs(this->energy(blocks[i])));
totalZeroCross.push_back(zerocross(blocks[i]));
if(!totalEnergy[i] > totalSum || totalZeroCross[i] < ZeroThres)
{
hasInsufficientEnergy();
}else{
//hasInsufficientEnergy();
}
iniMatrix::iterator erase_after = remove_if(blocks[i].begin(), blocks[i].end(),
&hasInsufficientEnergy);
}
}
問題はerase_afterであり、エラーメッセージが表示されます。
In function ‘_OutputIterator std::remove_copy_if(_InputIterator, _InputIterator,
_OutputIterator, _Predicate) [with _InputIterator = __gnu_cxx::__normal_iterator<double*,
std::vector<double, std::allocator<double> > >, _OutputIterator =
__gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >,
_Predicate = bool]’:
/usr/include/c++/4.2.1/bits/stl_algo.h:1302: instantiated from ‘_ForwardIterator
std::remove_if(_ForwardIterator, _ForwardIterator, _Predicate) [with _ForwardIterator =
__gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >,
_Predicate = bool]’
Audio.cpp:105: instantiated from here
/usr/include/c++/4.2.1/bits/stl_algo.h:1227: error: ‘__pred’ cannot be used as a function
誰かが私がどこで間違っているのかについて何か考えがありますか?