Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 0.27 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Free memory used by a std::string
  2. struct queue_item_t {
  3.     int id;
  4.     int size;
  5.     std::string content;
  6. };
  7.        
  8. my_queue_item.content.clear(); // clear
  9. std::string(my_queue_item.content).swap(my_queue_item.content); // compact
  10.        
  11. std::string().swap(my_queue_item.content);