Which one to use?
Auto Type Deduction in Range-Based For Loops
by Petr Zemek
From the article:
Have you ever wondered which of the following variants you should use in range-based for loops and when?
auto
,const auto
,auto&
,const auto&
,auto&&
,const auto&&
, ordecltype(auto)
? This post tries to present rules of thumb that you can use in day-to-day coding. As you will see, only four of these variants are generally useful.
Add a Comment
Comments are closed.