Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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];
});
Source by www.learncpp.com #
 
PREVIOUS NEXT
Tagged: #lambda #function
ADD COMMENT
Topic
Name
4+1 =