Вот моя функция кода:
template<typename W>
void cut(std::vector<W>& data, double frac)
{
auto size = data.size();
//calculate number of elements to be kept
int to_stay = floor(frac*size);
std::sort(data.begin(),data.end(),
[](const W& a, const W& b)->bool
{
return a <b;
});
// erase all elements after the last one to be kept
data.erase(data.begin(), data.begin() + to_stay);
data.erase(data.end() - to_stay, data.end());
}
Но я получаю сообщение об ошибке:
[](const W& a, const W& b)->bool error: expected expression
Что я могу сделать?