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.
More Related Contents:
- How to pass parameters correctly?
- What is constructor inheritance?
- How to call a function on all variadic template args?
- How to enable C++11 in Qt Creator?
- when g++ static link pthread, cause Segmentation fault, why?
- Why doesn’t narrowing conversion used with curly-brace-delimited initializer cause an error?
- How to actually implement the rule of five?
- Range-based for loop on a dynamic array?
- How to give priority to privileged thread in mutex locking?
- What causes runtime error message: std::system_error – operation not permitted, including mult-threading? [duplicate]
- Refactoring with C++ 11
- What is the difference between MinGW, MinGW-w64 and MinGW-builds?
- Why do objects returned from bind ignore extra arguments?
- std::shared_ptr thread safety explained
- Why can’t I capture this by-reference (‘&this’) in lambda?
- How to initialize `std::function` with a member-function?
- Hash an arbitrary precision value (boost::multiprecision::cpp_int)
- What does `auto && e` do in range-based for-loops?
- error::make_unique is not a member of ‘std’
- Does C++11 allow dollar signs in identifiers?
- How can I resize a 2D vector of objects given the width and height?
- Why is there no std::protect?
- reinterpret_cast between char* and std::uint8_t* – safe?
- How to get the precision of high_resolution_clock?
- How does =delete on destructor prevent stack allocation?
- c++11 Thread class how to use a class member function
- C++11 ‘native_handle’ is not a member of ‘std::this_thread’
- Does C++11 unique_ptr and shared_ptr able to convert to each other’s type?
- Proper way to receive a lambda as parameter by reference
- When to use functors over lambdas