Код: Выделить всё
#include
#include
#include
#include
#include
int main()
{
std::map temp;
for(int i = 0; i < 1000000; i++){
int first[] = {5,10,15,20,25};
int second[] = {10,20,30,40,50};
std::set temp2;
temp2.insert(first, first + 5);
std::set temp3;
temp3.insert(second, second + 5);
std::set temp4;
std::set_union(temp2.begin(), temp2.end(), temp3.begin(), temp3.end(), std::inserter(temp4, temp4.end()));
temp.insert(temp.end(), std::pair(i, temp4));
}
}
< /code>
Когда это время, это занимает около 10 секунд. Однако, когда я комментирую линию temp.insert (temp.end (), std :: pare (i, temp4)) Подробнее здесь: https://stackoverflow.com/questions/394 ... of-the-map