cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Unknown Operator
Unknown Operator
Jun 27, 2017 at 1:01pm UTC
christianwos
(20)
Hi everybody,
I was looking at some code and I noticed the following line:
for
(
auto
ch : _params.ch)
What does the ':' operator mean in this case? I have never seen it used with the auto operator.
Thanks.
Jun 27, 2017 at 1:12pm UTC
dhayden
(5798)
See Range-based for loop here:
http://www.cplusplus.com/doc/tutorial/control/
Jun 27, 2017 at 1:13pm UTC
keskiverto
(10399)
That is not an operator. It is
range
-syntax of
for
-loop that was introduced in C++11.
http://en.cppreference.com/w/cpp/language/range-for
Note that before C++11 the
auto
was a storage class specifier
http://en.cppreference.com/w/cpp/language/storage_duration
but since C++11 it does type deduction
http://en.cppreference.com/w/cpp/language/auto
Jun 27, 2017 at 1:20pm UTC
christianwos
(20)
Thank you to both of you!
Topic archived. No new replies allowed.