Element w indeksie w zestawie std ::?

Natknąłem się na ten problem: nie mogę wybrać pozycji w pozycji indeksu w normalnym trybiestd::set. Czy to błąd w STD?

Poniżej prosty przykład:

#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!
}

Wszystko, co mogę zrobić, aby rozwiązać problem?

questionAnswers(6)

yourAnswerToTheQuestion