[libc-commits] [PATCH] D129920: [libc] Trivial implementation of std::optional

Thorsten via Phabricator via libc-commits libc-commits at lists.llvm.org
Sat Jul 16 00:58:53 PDT 2022


tschuett added a comment.

Do you need the union and the `Placeholder`? In `reset` you reset the `StoredValue`. This implies something about `T`.

I would add asserts to catch misbehaviour.



================
Comment at: libc/src/__support/CPP/Optional.h:26
+template <class T> class Optional {
+private:
+  union {
----------------
The private is redundant or for documentation.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129920



More information about the libc-commits mailing list