Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <tuple>
- #include <string>
- #include <string.h>
- template<typename T>
- class foo
- {
- public:
- foo(T storage) : storage_(std::move(storage)) {}
- private:
- T storage_;
- };
- int main()
- {
- char* s2 = strdup("123");
- foo f { std::make_tuple(12,123,"1234") };
- foo f2 { std::make_tuple("321", s2) };
- free(s2);
- // still want to keep s2 stored in f2
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement