cpp lambda function
#include <iostream>
using namespace std;
bool isGreater = [](int a, int b){ return a > b; }
int main() {
cout << isGreater(5, 2) << endl; // Output: 1
return 0;
}
cpp lambda function
#include <iostream>
using namespace std;
bool isGreater = [](int a, int b){ return a > b; }
int main() {
cout << isGreater(5, 2) << endl; // Output: 1
return 0;
}
lambda function in c++
//lambda function for sorting vector ascending
sort(vec.begin(),vec.end(),[](int &a, int &b){
return a<b;
});
//lambda function for sorting vector of vector ascending based on first value
sort(vec.begin(),vec.end(),[](vector<int> &a, vector<int> &b){
return a[0]<b[0];
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us