SHARE
TWEET

Untitled

a guest Jun 18th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <tuple>
  2. #include <string>
  3. #include <string.h>
  4. template<typename T>
  5. class foo
  6. {
  7. public:
  8.     foo(T storage) : storage_(std::move(storage)) {}
  9. private:
  10.     T storage_;
  11. };
  12.  
  13. int main()
  14. {
  15.     char* s2 = strdup("123");
  16.  
  17.     foo f { std::make_tuple(12,123,"1234") };
  18.  
  19.     foo f2 { std::make_tuple("321", s2) };
  20.  
  21.     free(s2);
  22.     // still want to keep s2 stored in f2
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top