I am having some trouble/error appending to a vector in C++. My code is:
std::vector<int> maps(const std::vector<int> & values) {
for(int i = 0; i < std::vector.size(); i++){
values.pushback(maps[i] * 2);
}
return values;
}
My goal is to have a base list that holds some numbers, then create a new list containing those numbers doubled.
I'm getting an error, that is unfortunately too long to copy it in here. But I will give you the details:
Exit Code: 254
STDERR
Stack dump:
0. Program arguments: /usr/lib/llvm-8/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-(this is where it gets a bit long)
The full code is(I am guessing, since this is a puzzle)
#include <vector>
std::vector<int> maps(const std::vector<int> & values){
for(int i = 0; i < std::vector.size(); i++){
values.push_back(maps[i] * 2);
}
return values;
}
int main(){
return 0;
}