Provide factory function for nsAutoPtr
Categories
(Core :: XPCOM, task)
Tracking
()
People
(Reporter: sg, Unassigned)
Details
It would be good to have a factory function for nsAutoPtr<> similar to MakeRefPtr for RefPtr<> which allows to avoid literal new and use of auto such as in
auto ptr = MakeAutoPtr<DatabasesCompleteCallback>(...);
Comment 1•6 years ago
|
||
We're trying to get to the point where we use UniquePtr, rather than nsAutoPtr; I don't think we want to make nsAutoPtr more convenient to use in any way.
| Reporter | ||
Comment 2•6 years ago
|
||
Good to know that. Is there anything preventing replacing uses of nsAutoPtr by UniquePtr?
Comment 3•6 years ago
|
||
(In reply to Simon Giesecke [:sg] [he/him] from comment #2)
Good to know that. Is there anything preventing replacing uses of
nsAutoPtrbyUniquePtr?
People's time. nsAutoPtr's implicit conversion to T*, along with its move-like copy constructor behavior, makes the conversion not-quite-trivial.
| Reporter | ||
Comment 4•6 years ago
|
||
Surely it requires some effort. I was asking more to be sure there are no hidden caveats, even if after replacing uses it seems to compile and work fine. Thanks for pointing some things out one may run into. I have just replaced most uses of nsAutoPtr by UniquePtr in dom/indexedDB code (and made use of MakeUnique).
Description
•