Hello, I have to wirte this method and I'd like one efficent and compact:
Qt Code:
  1. int _low, _high;
  2. std::string MyClass:: print() {
  3. std::string str;
  4. std::string result;
  5. std::stringstream ss;
  6.  
  7. result += "[";
  8. ss << _low;
  9. ss >> str;
  10. result += str;
  11.  
  12. result.append("-");
  13.  
  14. ss << _high;
  15. ss >> str;
  16. result += str;
  17. result.append("]");
  18. return result;
  19. }
  20. //main
  21. MyClass mycl;
  22. cout << " The range is: " << mycl.print() << endl
To copy to clipboard, switch view to plain text mode 
it must print: "the range is [10-20]"

It seems too large and not compact.... How can I improve?
Thanks.