[PATCH] D69230: RFC: specialized Optional<T> for T that can represent its own invalid state

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 09:58:03 PDT 2019


labath added a comment.

In D69230#1718191 <https://reviews.llvm.org/D69230#1718191>, @lawrence_danna wrote:

> Seems like there's a consensus that if we have something like this it should be called `DenseOptional`, and changes to `Optional` should only make it more like `std::optional`


I am not sure I would call that a "consensus"  -- my interpretation of @dblaikie's comment is that he does not want an extra dense optional type either. Which I disagree with, because I think it would be useful to have some form of a compressed optional storage, as that's something that is currently often implemented via bitfields, magic invalid values, etc. That said, I think you have convinced me that having different optional representations for a single type is not a good idea. It's probably better to use some form of a "strong" typedef to achieve that instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69230





More information about the llvm-commits mailing list