c++ cli - is it possible to return two vectors from a function? -
im trying merge sort in cpp on vector called x, contains x coordinates. mergesort sorts x coordinates, supposed move corresponding elements in vector called y, containing y coordinates. problem dont know how (or if can) return both resulting vectors merge function. alternatively if easier implement use slower sort method.
no, cannot return 2 results method in example.
vector<int>, vector<int> merge_sort();
what can pass 2 vectors reference function , resultant mergesorted vector affects 2 vectors...e.g
void merge_sort(vector<int>& x, vector<int>& y);
ultimately, can @joshd mentioned , create struct
called point , merge sort vector of point struct instead.
Comments
Post a Comment