umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
cxx11-range-based-for-loop.h
Go to the documentation of this file.
1// https://en.wikipedia.org/wiki/C%2B%2B11#Range-based_for_loop
2
3// #1
4int my_array[5] = {1, 2, 3, 4, 5};
5// double the value of each element in my_array:
6for (int &x : my_array) {
7 x *= 2;
8}
9// similar but also using type inference for array elements
10for (auto &x : my_array) {
11 x *= 2;
12}
int x
Definition: cxx11-lambda-functions-and-expressions.h:4
int my_array[5]
Definition: cxx11-range-based-for-loop.h:4