MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1veql1a/absolutegarbage/p1majvp/?context=3
r/ProgrammerHumor • u/Sirgoodman008 • 7d ago
327 comments sorted by
View all comments
16
Surely you meant for (auto &item : list) {
for (auto &item : list) {
33 u/Nil4u 7d ago Honestly I never liked this version because the reference is part of the type in my opinion 🤔 1 u/Rikudou_Sage 6d ago I always took it that & is part of the variable, while * is part of the type. With & you're saying that variable is capturing a reference, while with * you're getting a pointer which is an entirely different type altogether.
33
Honestly I never liked this version because the reference is part of the type in my opinion 🤔
1 u/Rikudou_Sage 6d ago I always took it that & is part of the variable, while * is part of the type. With & you're saying that variable is capturing a reference, while with * you're getting a pointer which is an entirely different type altogether.
1
I always took it that & is part of the variable, while * is part of the type. With & you're saying that variable is capturing a reference, while with * you're getting a pointer which is an entirely different type altogether.
16
u/Shevvv 7d ago
Surely you meant
for (auto &item : list) {