Which is correct: vector
OR const vector
I want to create an std::vector
of std::stri
If your only choices are those two and you want the program to compile, use const std::vector<std::string>
.
If you don't mind compilation errors (both on GCC4.8 and Clang), probably due to the fact that const std::string
does not meet the requirement of CopyAssignable (prior to C++11) or MoveAssignable (since C++11), even though, apparently, it's mostly because it's not Destructible, use std::vector<const std::string>
.