5 ms·
OK, I must have mistaken what the original was, because I thought it was like this: processWidget(new Widget, priority()); I think I saw the above code elsewh
by TwoBit 5y ago
OK, I must have mistaken what the original was, because I thought it was like this:
processWidget(new Widget, priority());
I think I saw the above code elsewhere.
- ronyclau 5y agoIIRC, this may also leak when `priority()` throws due to evaluation order. (Not exactly sure now, as I now always use `make_shared` whenever possible.) However in the Effective C++ example, the `shared_ptr` constructor gave a false sense of security as it seemed the `new`-ed `Widget` was always managed by the smart pointer from its allocation.