Pagini recente » Diferente pentru suffix-array-liniar intre reviziile 32 si 33 | Diferente pentru suffix-array-liniar intre reviziile 77 si 78 | Diferente pentru blog/cubrid-bug-bash intre reviziile 15 si 14 | Diferente pentru suffix-array-liniar intre reviziile 74 si 75 | Diferente pentru blog/cpp11 intre reviziile 37 si 38
Diferente pentru
blog/cpp11 intre reviziile
#37 si
#38
Nu exista diferente intre titluri.
Diferente intre continut:
s.insert(v);
==
You don't need to worry about collisions, $unordered_set$ and $unordered_map$ will take care of that for you.
You don't need to worry about collisions, $unordered_set$ and $unordered_map$ will take care of them for you.
h3. 5. lambda functions
You can now define anonymous functions to write less code. A common application is sorting according to multiple criteria.
== code(cpp) |
#include <algorithm>
using namespace std;
...
vector<int> a = {5, 3, 1, 3};
vector<int> b = {6, 1, 7, 2};
vector<int> indexes = {0, 1, 2, 3};
sort(indexes.begin(), indexes.end(), [&a, &b](int x, int y) -> bool {
return a[x] < a[y] || (a[x] == a[y] && b[x] < b[y]);
});
==
(Often, a cleaner alternative to lambda functions is defining a class holding all the data needed for sorting and providing an implementation for the $<$ operator.)
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.