Setting vector elements in range-based for loop [duplicate]

Change this loop statement

for(auto n: *CTdata)

to

for(auto &n : *CTdata)

that is you have to use references to elements of the vector.

Leave a Comment