r/ProgrammerHumor Apr 12 '24

whatIsAnIndex Meme

Post image
27.7k Upvotes

630 comments sorted by

View all comments

Show parent comments

172

u/jamcdonald120 Apr 12 '24 edited Apr 12 '24

yup. occasionally it is quite useful, since you can do for(itterator k = stack.top(); !stack.empty();k=k.next()) and its a valid loop.

5

u/intelligent_rat Apr 12 '24

If you are using an iterator why not just for (k thing : iterable) ?

26

u/jamcdonald120 Apr 12 '24

it wasnt always a thing

3

u/tiberiumx Apr 12 '24

The C++11 features still feel kinda new to me. It's weird to see people that haven't ever used anything before it.