F
franceschini.roberto
Hello,
copying from the web I maged to initialize a vector of integers from an array.
int myints[] = { 16, 2, 77, 29 };
vector<int> fifth(ord1, ord1 + sizeof(ord1) / sizeof(int));
Now I would like to turn this into a function that I can later call as
vector<int> myvec;
myvec = initialize_Vector( {1,2,3,4} )
I am becoming crazy with the passage of the array as argument of the function (pointer, values, ... dunno)
Can anybody explain how to write this function?
Of course any alternative solution that allows me to initialize a vector by just specifying the values it contains in a one line it's more than welcome
Thanks to everybody for reading and replying.
Roberto
copying from the web I maged to initialize a vector of integers from an array.
int myints[] = { 16, 2, 77, 29 };
vector<int> fifth(ord1, ord1 + sizeof(ord1) / sizeof(int));
Now I would like to turn this into a function that I can later call as
vector<int> myvec;
myvec = initialize_Vector( {1,2,3,4} )
I am becoming crazy with the passage of the array as argument of the function (pointer, values, ... dunno)
Can anybody explain how to write this function?
Of course any alternative solution that allows me to initialize a vector by just specifying the values it contains in a one line it's more than welcome
Thanks to everybody for reading and replying.
Roberto