TwoBit
Joined 17 years ago
Karma
2,039
Submissions
1,119
Member since
Mar 11
Joined 17 years ago
processWidget(new Widget, priority());
I think I saw the above code elsewhere.
I don't see how that is so. C++ 17 allows new Widget to complete and then the priority() call to execute and throw before both are passed to shared_ptr(), thus creating a leak. Your cited example [1] doesn't leak because both arguments are shared_ptr. Seems to me that C++ 17 does indeed solve this latter case but not the former.
yes