मुझे एक पोस्ट में मिला है कि एक इटरेटर का उपयोग करके कंटेनर से तत्वों को कैसे हटाया जाए। जबकि पुनरावृत्ति:ऑटो वैरिएबल और इसके प्रकार
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
}
क्यों auto
auto next = it;
में प्रकार के बिना किया जाता है?
मैं वीएस 10 का उपयोग करता हूं, सी ++ 11 नहीं!
देखें [सी ++ 11 प्रकार अनुमान] (http://en.wikipedia.org/wiki/C%2B%2B11#Type_inference) – juanchopanza
वीएस 10 में डिफ़ॉल्ट रूप से सी ++ 11 है। तो, आप सी ++ 11 का उपयोग करते हैं। –