<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 18, 2014 at 11:15 PM, Kim Gräsman <span dir="ltr"><<a href="mailto:kim.grasman@gmail.com" target="_blank">kim.grasman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Mon, Aug 18, 2014 at 1:25 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>

> On Sun, Aug 17, 2014 at 3:20 PM, Rafael Espindola<br>
> <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
>><br>
</div><div class="">>>      llvm::SourceMgr SM;<br>
>> -    Stream YAMLStream(FileBufOrErr.get().release(), SM);<br>
>> +    Stream YAMLStream(std::move(FileBufOrErr.get()), SM);<br>
><br>
> Thought: this is actually one place where I more strongly prefer using<br>
> the pointer-like API of ErrorOr. Seeing "move(x.get())" makes me<br>
> twitch and think "is that moving a raw pointer? some mistake where the<br>
> user was trying to indicate transfer of ownership from a unique_ptr<br>
> and clearly failing". Whereas move(*x) seems clear/sort of better.<br>
<br>
</div>I also did a double-take when I updated our tool and saw this. I<br>
considered std::move(*x), and I agree that it's less confusing, but I<br>
wonder if something more explicit could be done with ErrorOr to move<br>
out its value? A take() method, for example (I can't quite see clearly<br>
how it would play with move semantics for non-movable T's, exercise<br>
for the reader.)<br></blockquote><div><br></div><div>Strawman:</div><div><br></div><div>FooOrErr.takeByMove()</div><div><br></div><div>with an enable_if to remove it for non-movable types.</div><div><br></div><div>However, I personally I don't find the std::move(*x) to be that problematic.</div>
<div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
- Kim<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>