There's more then one way to clear a vector



  • std::vector<CString> vecString;
    <snip 10 lines>

    while(vecString.size() > 0)
    {
       vecString.pop_back();
    }

     

    Enough said. 



  • Classic!

    That reminds me of another one I came across a while ago...

    This is from a constructor:

       vector<string> currentLine(num*2);
       m_currentLine = currentLine; 

    I suppose at least they didn't do push_back(0) in a loop...


Log in to reply