Hello,
does std::multimap make any guarantee about the insertion order?
for example:
int main()
{
std::multimap<i nt, int> Map;
Map.insert(std: :make_pair(0, 1));
Map.insert(std: :make_pair(0, 2));
Map.insert(std: :make_pair(0, 3));
Map.insert(std: :make_pair(0, 4));
std::copy(Map.b egin(), Map.end(), std::ostream_it erator<int>(std ::cout,
" "));
}
Will it always output 1 2 3 4 in that order? and will equal_range(0) always
give 1 2 3 4 too?
Or is it platform dependent and is allowed to output 2 4 3 1 for example?
Thanks for your help.
Best regards,
Tanguy
does std::multimap make any guarantee about the insertion order?
for example:
int main()
{
std::multimap<i nt, int> Map;
Map.insert(std: :make_pair(0, 1));
Map.insert(std: :make_pair(0, 2));
Map.insert(std: :make_pair(0, 3));
Map.insert(std: :make_pair(0, 4));
std::copy(Map.b egin(), Map.end(), std::ostream_it erator<int>(std ::cout,
" "));
}
Will it always output 1 2 3 4 in that order? and will equal_range(0) always
give 1 2 3 4 too?
Or is it platform dependent and is allowed to output 2 4 3 1 for example?
Thanks for your help.
Best regards,
Tanguy
Comment