FWIW there are other non-pointers that use pointer-like semantics, such as boost::optional. So there's precedence in some pretty mainstream APIs for this design.<br><br>But I don't work with code using this type very much, so it's best left up to you/them to decide what kind of API they're most comfortable with.<br>
<br>Perhaps a thread link for the "as was observed before" reference would also be useful.<br><div>On Wed Jan 08 2014 at 10:47:42 AM, Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">With the mangler out of the way I got back to coding a lib/Object<br>
interface for IR files. The first part being modernizing the IR api to<br>
use error_code and ErrorOr.<br>
<br>
Doing so I found one more issue with ErrorOr. It has a pointer like<br>
API, but it is not a pointer. It stores a value of type T, not a<br>
pointer to T. Modifying the stored object causes nothing else to be<br>
mutated and, as was observed before, an ErrorOr<smart_pointer<T> > is<br>
a fairly confusing thing.<br>
<br>
The attached patch are<br>
<br>
* add-new-api.patch: Just adds the get and getError methods.<br>
* convert-llvm.patch: Converts llvm to use the new methods.<br>
* convert-lld.patch: Converts lld to use the new methods.<br>
* remove-old-api.patch: Remove the pointer API and simplify the bool operator.<br>
<br>
Cheers,<br>
Rafael<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
</blockquote>