[Lldb-commits] [PATCH] D69230: RFC: specialized Optional<T> for T that can represent its own invalid state
serge via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 22 02:30:41 PDT 2019
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
More information about the lldb-commits
mailing list