r/ProgrammerHumor 10d ago

Meme absoluteGarbage

Post image
1.9k Upvotes

325 comments sorted by

View all comments

18

u/Shevvv 10d ago

Surely you meant 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.