[libcxx-commits] [libcxx] [libc++] Simplify the implementation of std::get for pairs (PR #114984)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 12 09:16:57 PST 2024


================
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template<size_t I, class T1, class T2>
+//     typename tuple_element<I, std::pair<T1, T2> >::type&&
+//     get(pair<T1, T2>&&);
+
+#include <cassert>
+#include <utility>
+
+#include "test_macros.h"
+
+TEST_CONSTEXPR_CXX14 bool test() {
+  int i = 1;
+  int j = 2;
+
+  {
+    std::pair<int&, int&&> p(i, std::move(j));
----------------
ldionne wrote:

Maybe test with entirely different types too?

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


More information about the libcxx-commits mailing list