0

Is there any good way for assigning std::vector to std::multiset? Other than iteration of course. I see that in C++11 there is something like initializer list, maybe it can be used somehow?

user1873947
  • 1,781
  • 3
  • 27
  • 47

2 Answers2

13
vector<int> v;
//fill your vector
multiset<int> m (v.begin(), v.end());
us2012
  • 16,083
  • 3
  • 46
  • 62
4

Use this:

std::vector<SOME_TYPE> a;
....
std::multiset<SOME_TYPE> ms(a.begin(), a.end());
Ivaylo Strandjev
  • 69,226
  • 18
  • 123
  • 176