-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlambda_sort.cpp
More file actions
32 lines (27 loc) · 880 Bytes
/
lambda_sort.cpp
File metadata and controls
32 lines (27 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//*****************************************************************************
//
// Author: Michael Price
// License: Attribution-NonCommercial-NoDerivs 3.0 Unported
// http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode
//
//*****************************************************************************
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
void gotta_sort_em_all ()
{
//vector<string> pokemon = { "Pikachu",
// "Charmander",
// "Squirtle" };
vector<string> pokemon;
pokemon.push_back("Pikachu");
pokemon.push_back("Charmander");
pokemon.push_back("Squirtle");
auto srt = [] (const string & l,
const string & r)
{
return (l.length() < r.length());
};
sort(begin(pokemon), end(pokemon), srt);
}