Cpp-Primer
Cpp-Primer copied to clipboard
Exercise 9.22: segment fault
when vector
Hi ycbw,
I tried the vector you mentioned and the code is like below:
#include
void double_and_insert(std::vector
int main()
{
std::vector
for (auto i : v)
std::cout << i << std::endl;
}
It ran as expected. You may have a wrong vector name, instead of "iv", you should use "v".