Q:

how to copy elements from hash to vector c++

/* make sure that the vector can include the element in the map
*/

#include <vector>
#include <map>
using namespace std;

int main(){
    map<int, vector<vector<int>> hash;
  	vector<vector<vector<int>>> putTo;
  	map<int, vector<vector<int>>::iterator it;
  	
  	for(it = hash.begin(); it != hash.end(); it++){
      	// notice if the putTo was a 2D we can add it->second to it;
      	// it have to be 3D in order to hold a 2D array
    	putTo.push_back(it->second);  
    }
	return 0;
}


1

New to Communities?

Join the community