Jeff Walden wrote:

Additionally, UniquePtr is best used by threading it through interfaces, beyond just 
immediate use sites.  Rather than returning a raw pointer, code should return UniquePtr 
instead.  Rather than extracting a raw pointer to pass to a method, code should pass 
Move(ptr) instead, and that argument should be a UniquePtr&&.

Only UniquePtr's own copy and assignment operators should take UniquePtr&&. Other call sites should either take const UniquePtr& (if they will not take ownership of the pointer), UniquePtr& (if they may or may not need to take ownership of the pointer) or UniquePtr (if they will take ownership of the pointer).

--
Warning: May contain traces of nuts.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to