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

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jul 19 23:28:59 PDT 2022


sivachandra added a comment.

In D129920#3664742 <https://reviews.llvm.org/D129920#3664742>, @jeffbailey wrote:

> Updating with some review comments addressed, but not the asserts or the
> testsuite, etc.

I think, starting with a simple implementation like this is OK. IMO, we do not have to mimic `std::optional` - IIUC, we want something similar for our convenience but not exactly equal.  So, this is LGTM after expanding the testsuite. Please wait for Guillaume though.



================
Comment at: libc/src/__support/CPP/Optional.h:21-24
+// This is very simple implementation of the std::optional class.  There are a
+// number of guarantees in the standard that are not made here.
+//
+// This class will be extended as needed in future.
----------------
gchatelet wrote:
> I would list the requirements for `T` here, AFAICT:
>  - default constructible
>  - copy constructible
>  - copy assignable
>  - destructible
I think Guilllaume is just asking you to list them for now. IIUC, except for the default constructible requirement, they are already enforced?


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