serge-sans-paille added inline comments.

================
Comment at: llvm/include/llvm/ADT/Optional.h:216
+  OptionalStorage &operator=(T const &y) {
+    assert(Info::is_valid(y));
+    value = y;
----------------
Slight note (borrowed from [this 
thread](https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/46J1onhWJ-s/discussion).

This implementation, compared to the generic one, is not type-safe and relies 
on an assert on `y` to check whether it's the sentinel or not. This is a slight 
change that may matter (somehow trading type-safety for performance).

Possible exploration path: if the sentinel has its own type (e.g. 
std::nullptr_t) we somehow improve type safety, but still don't have the same 
guarantee as the generic implementation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69230/new/

https://reviews.llvm.org/D69230



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to