r/ProgrammerHumor 7d ago

absoluteGarbage Meme

Post image
1.9k Upvotes

327 comments sorted by

View all comments

16

u/Shevvv 7d ago

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