[libcxx-commits] [libcxx] Speed up compilation of common uses of std::visit() (PR #164196)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 30 06:03:25 PDT 2026


================
@@ -1332,6 +1332,10 @@ private:
   friend struct __variant_detail::__visitation::__variant;
 };
 
+template <class... _Types>
+variant<_Types...> __upcast_to_variant(const volatile variant<_Types...>*);
----------------
ldionne wrote:

I checked out the code and tried a couple of ways to simplify the metaprogramming, and after 15 minutes of hitting complications, I think the approach in this patch is acceptable, if not super pretty. It turns out to be quite tricky to balance code duplication, correctness, forwarding and the handling of a derived classes.

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


More information about the libcxx-commits mailing list