fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. string s("Some example string. Let's give it few more bytes.");
  6. cout << s.capacity() << '\n';
  7. s = "";
  8. cout << s.capacity() << '\n';
  9. s.shrink_to_fit();
  10. cout << s.capacity() << '\n';
  11. return 0;
  12. }
Compilation error #stdin compilation error #stdout 0s 3228KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:9:4: error: 'std::string' has no member named 'shrink_to_fit'
  s.shrink_to_fit();
    ^
stdout
Standard output is empty