Я наткнулся на эту проблему: я не могу выбрать элемент в позиции индекса в обычном std:: set. Это ошибка в STD?
Ниже простого примера:
#include <iostream>
#include <set>
int main()
{
std::set<int> my_set;
my_set.insert(0x4A);
my_set.insert(0x4F);
my_set.insert(0x4B);
my_set.insert(0x45);
for (std::set<int>::iterator it=my_set.begin(); it!=my_set.end(); ++it)
std::cout << ' ' << char(*it); // ups the ordering
//int x = my_set[0]; // this causes a crash!
}
Что-нибудь, что я могу сделать, чтобы исправить проблему?