Guest User

Untitled

a guest
Apr 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <algorithm>
  2. #include <string.h>
  3. #include <iostream>
  4.  
  5. class Stuff
  6. {
  7. public:
  8. Stuff(std::string* str_ = 0) : str_ (str_){}
  9. ~Stuff(){delete[] str_;}
  10. std::string* get(){return str_;}
  11. std::string* operator->(){ return str_;}
  12. std::string& operator*() { return *str_;}
  13.  
  14. Stuff(const SmartString& other)
  15. {
  16. std::copy(other.str_, other.str_+ counter_, str_);
  17. }
  18.  
  19. Stuff& operator=(const Stuff& other)
  20. {
  21. swap(*this, other);
  22. return *this;
  23. }
  24. private:
  25. std::string* str_;
  26. unsigned int* counter_;
  27. };
Add Comment
Please, Sign In to add comment