i want to have a vector of strings. i know i could declare it by
#include <iostream> #include <string> using namespace std; vector<string> vec; vec.push_back("this"); vec.push_back("is"); vec.push_back("my"); vec.push_back("array");
but thats very tedious. isnt there a more elegant way?
if i had the vector as an argument to a function, i would have to declare it first, then fill it, and then give it to the function as vec (like if i had a function fun which takes an integer as argument, and i would have to go: int i = 5; fun (i); instead of just fun(5)).