Guest User

Untitled

a guest
Aug 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. Lifetime of return value in comma separated statements
  2. struct S
  3. {
  4. S() { /* called 1st */ }
  5. ~S() { /* called 3rd */ }
  6. };
  7.  
  8. boost::shared_ptr<S> f()
  9. {
  10. return boost::shared_ptr<S>(new S);
  11. }
  12.  
  13. int second() { return 0; /* called 2nd */ }
  14.  
  15. int test()
  16. {
  17. return (f(), second());
  18. }
Add Comment
Please, Sign In to add comment