[libcxx-commits] [PATCH] D44865: [libc++] Implement P0608R3 - A sane variant converting constructor

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 9 20:54:48 PDT 2019


zoecarver added a comment.

A few minor things:

- the spacing is different from the rest of libc++ (a lot of it was that way before).
- since this is a paper it should probably be guarded with `#if _LIBCPP_STD_VER > 17`
- update the status in `www`.

Also, the standard says explicitly, "A variant is permitted to hold the same type more than once, and to hold differently cv-qualified versions of the same type." But currently, that is not allowed — not an issue with this patch, but something that should be fixed.



================
Comment at: include/variant:1110
+template <class _Base, class _Tp>
+struct __overload_bool : _Base {
+  using _Base::operator();
----------------
Is this structure 100% necessary? Couldn't `__overload` add an overload to take care of `bool`s? Maybe something like this:
 
```
  template<class _Up>
  auto operator()(_Tp, _Up&&) const
    ->  enable_if_t<
            is_same_v<__uncvref_t<_Up>, bool>,
            __identity<_Tp>
        >;
```


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D44865





More information about the libcxx-commits mailing list