What is the meaning of the two parts specified between parentheses in a range-based for loop, separated by a colon?

Advertisement

  • The first is a variable declaration that will hold an element in a sequence. The second is the sequence to traverse.
  • The first is an iterator, and the second is the increment value to be added to the iterator.
  • The first is the iterating variable. The second is an std::pair that specifies the range (start and end) in which the variable will iterate.
  • The first is a container object. The second is an std::pair that specifies the range (start and end) in which the elements will be accessed within the loop.
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend