Pagini recente » Suffix array in O(N) | SKREFI | Suffix array in O(N) | Suffix array in O(N) | Diferente pentru blog/cpp11 intre reviziile 7 si 6
Diferente pentru
blog/cpp11 intre reviziile
#7 si
#6
Nu exista diferente intre titluri.
Diferente intre continut:
$auto$ can also be used with $const auto$ or $const auto&$. It works in the same way other types would work. In most cases, $auto$ cannot be used in function signatures.
h3. range-based for loops
In $C++11$, you can iterate over each element in a list with less code:
== code(cpp) |
int array[5] = {1, 2, 3, 4, 5};
for (int x: array) {
printf("%d\n", x);
}
==
If you want to modify the elements in the list, you need to get a reference to the element like this:
== code(cpp) |
int array[5] = {1, 2, 3, 4, 5};
for (int &x: array) {
x *= 2;
}
==
Note, this code compiles without $&$, but the original array is not modified unless a reference is used.
h3.
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.