Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 33,306 of 33,346    |
|    wojtek.mula@googlemail.com to All    |
|    std::string - clear and memory dispose    |
|    14 Apr 14 12:20:07    |
   
   Hi, this is my first post on this group.   
      
   Is it legal that method std::string::clear() also shrinks memory   
   buffer? For example:   
      
    std::string str("long string");   
    std::cout << str.size() << ", " << str.capacity(); // print: 11, 24   
    str.clear();   
    std::cout << str.size() << ", " << str.capacity(); // print: 0, 0   
      
   Popular implementations keeps the buffer (i.e. the fourth line prints   
   "0, 24"), but I can't find any requirement in the standard.   
      
   w.   
      
      
   --   
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca