[libcxx-commits] [libcxx] [libc++] Remove <tuple> from <variant> (PR #83183)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 8 12:16:33 PST 2024


================
@@ -340,21 +345,20 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
 
 inline constexpr size_t variant_npos = static_cast<size_t>(-1);
 
-_LIBCPP_HIDE_FROM_ABI constexpr int __choose_index_type(unsigned int __num_elem) {
-  if (__num_elem < numeric_limits<unsigned char>::max())
-    return 0;
-  if (__num_elem < numeric_limits<unsigned short>::max())
-    return 1;
-  return 2;
+template <size_t _NumAlternatives>
----------------
EricWF wrote:

Consider returning `integral_constant<T, 0>` so that we don't have to worry about type conversions, promotions, etc.

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


More information about the libcxx-commits mailing list