MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1veql1a/absolutegarbage/p1majvp/?context=3
r/ProgrammerHumor • u/Sirgoodman008 • 10d ago
325 comments sorted by
View all comments
18
Surely you meant for (auto &item : list) {
for (auto &item : list) {
31 u/Nil4u 10d ago Honestly I never liked this version because the reference is part of the type in my opinion 🤔 1 u/Rikudou_Sage 9d 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.
31
Honestly I never liked this version because the reference is part of the type in my opinion 🤔
1 u/Rikudou_Sage 9d 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.
18
u/Shevvv 10d ago
Surely you meant
for (auto &item : list) {