Probably its a late night struggle, but I am stuck with a simple thing here guys:
int main()
{
std::vector<int> v{1,2,3,4,5 };
int N;
std::cin>>N;
auto it = std::find(v.begin(), v.end(), [=](auto it)
{
return it*it == N;
});
}
I just want the first value whose square is N, and compiler erred with:
error C2678: binary '==': no operator found which takes a left-hand operand of type 'int' (or there is no acceptable conversion)
Please hint what am I missing here?
Aucun commentaire:
Enregistrer un commentaire