I have come across what I consider weird behaviour with the c++11 range-based for loop when assigning to elements of a dynamically allocated std::vector. I hav
std::vector
you have to write
for( auto& n : *CTdata )
because auto n means short int n when you need short int& n. i recommend you to read difference beetween decltype and auto.
auto n
short int n
short int& n