[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
Wed Oct 30 09:05:12 PDT 2019


labath added a comment.

BTW, I was bored on the plane, so I created this proof of concept F10589216: dense.cc <https://reviews.llvm.org/F10589216>. It needs a lot of cleanup of course, but it demonstrates one way to generically store some extra data with some type. It gives each type the option to define a bunch of unused (the patch calls them "free") values (which can be useful for for Optional<>s, DenseMaps, etc.). Also each type can say that it is able to store some extra unrelated bits (like PointerIntPair does), and with a bit of care, one can even nest these types arbitrarily). the main thing I haven't yet figured out is the relationship with DenseMapInfo. Theoretically DenseMapInfo could be implemented on top of DenseInfo, but I am still wondering whether we could not make that a single type (trait) somehow...


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