[libcxx] [flang] [clang] [compiler-rt] [llvm] [lldb] [clang-tools-extra] [libc] [lld] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

A. Jiang via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 2 21:48:00 PST 2024


================
@@ -1273,6 +1293,22 @@ public:
     __impl_.__swap(__that.__impl_);
   }
 
+#  if _LIBCPP_STD_VER >= 26
+  // [variant.visit], visitation
+
+  template <int = 0, class _Self, class _Visitor>
----------------
frederick-vs-ja wrote:

Would it be better to use a special tag type like this
```C++
struct __variant_visit_barrier_tag { // unnamable when using standard library modules
  explicit __variant_visit_barrier_tag() = default;
};
// ...
template <__variant_visit_barrier_tag = __variant_visit_barrier_tag{}, class _Self, class _Visitor>
// ...
```
to avoid accepting `v.visit<0, T, F>(f)`?

https://github.com/llvm/llvm-project/pull/76447


More information about the cfe-commits mailing list