Xidorn Quan writes:

> I think this specific case should actually use UniquePtr<MediaFile>& rather
> than && in parameter for conditional move, so that callsite can only pass
> in an lvalue, and we don't need a Move there.

Jim Blandy writes:

> TakeMediaIfKnown is accepting a
> UniquePtr<MediaFile> as an inout parameter: it uses, and may modify, its
> value. It should take UniquePtr<MediaFile> &.
>
> UniquePtr.h disagrees with me:
>
>  * ...  To conditionally transfer
>  * ownership of a resource into a method, should the method want it, use a
>  * |UniquePtr&&| argument.

UniquePtr<MediaFile>* would make it clear at the call site that
something out of the ordinary can happen.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to