Ich habe in einem Beitrag gefunden, wie Elemente aus einem Container mit einem Iterator gelöscht werden. Während Iterieren:auto variable und sein Typ
for(auto it = translationEvents.begin(); it != translationEvents.end();)
{
auto next = it;
++next; // get the next element
it->second(this); // process (and maybe delete) the current element
it = next; // skip to the next element
}
Warum ist auto
ohne die Art in auto next = it;
verwendet?
Ich benutze VS10, nicht C++ 11!
Siehe [C++ 11 Typ Rückschluss] (http://en.wikipedia.org/wiki/C%2B%2B11#Type_Inference) – juanchopanza
VS10 hat C++ 11 standardmäßig aktiviert. Also, Sie verwenden C++ 11. –