Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

std::string is a useful tool for simplifying memory management of strings and avoiding unnecessary copies by reference counting. However there is one common gotcha where it causes unnecessary copies. Consider:

...