[libc-commits] [PATCH] D150211: [libc] Extend optional to support non trivially destructible types

Mikhail Ramalho via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Aug 11 11:59:33 PDT 2023


mikhail.ramalho added inline comments.


================
Comment at: libc/src/__support/CPP/optional.h:126-132
+  // SFINAE helpers
+  template <typename T2>
+  using __not_self = __not_<is_same<optional, remove_cvref_t<T2>>>;
+  template <typename T2>
+  using __not_tag = __not_<is_same<in_place_t, remove_cvref_t<T2>>>;
+  template <typename... _Cond>
+  using _Requires = enable_if_t<__and_<_Cond...>::value, bool>;
----------------
michaelrj wrote:
> is this actually necessary? The objects that we're wrapping in optional are mostly simple structs or primitives.
It was being used for forwarding the arguments in the new move constructor I've added; by removing it, I'll have to revert the test changes.


================
Comment at: libc/src/__support/CPP/type_traits.h:63
 
-template <typename T> struct add_rvalue_reference : type_identity<T &&> {};
-
----------------
michaelrj wrote:
> why is this removed?
It wasn't being used, but I'll add it back.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150211



More information about the libc-commits mailing list