SENIORCPP Telegram 2885
➡️ Циклы for по диапазону

Синтаксический сахар для перебора элементов контейнера.

std::array<int, 5> a {1, 2, 3, 4, 5};
for (int& x : a) x *= 2;
// a == { 2, 4, 6, 8, 10 }


Обратите внимание на разницу при использовании int в противовес int&:

std::array<int, 5> a {1, 2, 3, 4, 5};
for (int x : a) x *= 2;
// a == { 1, 2, 3, 4, 5 }
Please open Telegram to view this post
VIEW IN TELEGRAM



tgoop.com/seniorcpp/2885
Create:
Last Update:

➡️ Циклы for по диапазону

Синтаксический сахар для перебора элементов контейнера.

std::array<int, 5> a {1, 2, 3, 4, 5};
for (int& x : a) x *= 2;
// a == { 2, 4, 6, 8, 10 }


Обратите внимание на разницу при использовании int в противовес int&:

std::array<int, 5> a {1, 2, 3, 4, 5};
for (int x : a) x *= 2;
// a == { 1, 2, 3, 4, 5 }

BY Senior C++ Developer




Share with your friend now:
tgoop.com/seniorcpp/2885

View MORE
Open in Telegram


Telegram News

Date: |

Judge Hui described Ng as inciting others to “commit a massacre” with three posts teaching people to make “toxic chlorine gas bombs,” target police stations, police quarters and the city’s metro stations. This offence was “rather serious,” the court said. To edit your name or bio, click the Menu icon and select “Manage Channel.” How to build a private or public channel on Telegram? Step-by-step tutorial on desktop: With the “Bear Market Screaming Therapy Group,” we’ve now transcended language.
from us


Telegram Senior C++ Developer
FROM American