umbrello 2.39.2 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 int my_array[5] = {1, 2, 3, 4, 5};
5// double the value of each element in my_array:
6 for (int &x : my_array) {
7 x *= 2;
8}
9// similar but also using type inference for array elements
10 for (auto &x : my_array) {
11 x *= 2;
12}
x
int x
Definition cxx11-lambda-functions-and-expressions.h:4
my_array
int my_array[5]
Definition cxx11-range-based-for-loop.h:4