char *values = " 3 1 4 15";
vector<int> array;
I want to populate the array with the values,
3,1,4,15
Is there a slick way to do it with the stl copy algorithm?
From stackoverflow
-
Indeed there is:
std::istringstream iss(values); std::copy(std::istream_iterator<int>(iss), std::istream_iterator<int>(), std::back_inserter(array));EvilTeach : Yep, right on target. I feel more educated already. Thank you.
0 comments:
Post a Comment