Closed Bug 1562333 Opened 5 years ago Closed 5 years ago

`mozilla::Result` doesn't support move construction from an Ok value

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1418624

People

(Reporter: jimb, Unassigned)

Details

Constructing Result<T, E> from a T value will never use a move constructor.

The constructor for ResultImplementation forces T to be passed by value:
https://searchfox.org/mozilla-central/rev/867cbb1a2b232398616e1aa42f913f37c6cb38e4/mfbt/Result.h#71

This makes Result difficult to use for types that benefit from moves.

Worse is that Result can't handle move-only types (UniquePtr!) at all.

I think this was fixed by Bug 1418624.

Yes.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.