c++ - overwriting map with map possible with <algorithm>? -


i following seems not possible. no expert on stl.

typedef std::map<int,int> cmap;  cmap m1; m1[0] = 10; m1[1] = 11; m1[2] = 12;  cmap m2; m2[20] = 30; m2[21] = 31; m2[22] = 32;  std::copy( m1.begin(), m1.end(), m2.begin() ); 

is there way using algorithm (c++98)? done transform() or replace()? if yes, how?

thanks!

you can this:

m2 = m1; 

or if like:

m2.swap(m1); 

and there too:

std::copy(m1.begin(), m1.end(), std::inserter(m2, m2.end())); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -