Thursday, November 12, 2015

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on Reader Q&A: auto and for loop index variables by Greg Marr

Adam, even better than both in that it doesn’t introduce variables into the outer scope:

  for (decltype(object.size()) i = 0, n = object.size(); i < n; ++i)  

That is, unless the loop body does something that can change the size of object, in which case you do need your second form, and you have to live with any extra size() calls.

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

No comments:

Post a Comment