Firestone's blog

By Firestone, history, 22 months ago, In English

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

Don't use for(auto &x: a) for a[N]

  • Vote: I like it
  • -9
  • Vote: I do not like it

| Write comment?
»
22 months ago, # |
  Vote: I like it 0 Vote: I do not like it

And what's wrong with that usage (another from using variable length array if N is variable)?

»
22 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Why?

»
22 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Programming shouldn't devolve into a collection of "don't"s.

Rather, do understand the constructs you use, and you'll be fine.