Search code examples
c++-cli

% operator in for loop (not modulo operator!)


I found some code written by a coworker by accident that compiles but we both do not know what it really means:

What does the % sign in following code do?

for (auto% layer : layers) { /* ...*/ }

This actually is a typo and was meant to be following:

for (auto &layer : layers) { /* ...*/ }

Solution

  • % is the c++-cli Tracking Reference Operator