I have to work with medium large data files. They are anything from 1 to 1024 x 262144 doubles. Of course at any one I do not use all of them (not at the moment) I only need 262144 points at a time however I read them in in one go to a vector of vectors. I can of course use the .push_back() method to construct a new vector and return it from a method (which works well in a for loop) but I was wondering whther I could use some iterator type constructor of the new 1D vector from the 2D vector or better just to rertun a pointer to the specfic vector in the 2D vector. So far I tried this:
<auto start=twoD.begin()+slice*262144;
auto end=start+262144;
std::vector<double> new1D(start,end);>
However this does not work and throws a compile error of:
"no matching constructor for initialization of 'std::vector<double>'"
Is there way to have iterators which will work in a 1D vector constructor? What is the most effective way to return a vector from a vector of vector?