[libcxx-commits] [libcxx] [libc++] P1789R3: Library Support for Expansion Statements (PR #167184)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Dec 14 21:48:10 PST 2025


================
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++26
+
+// <utility>
+
+// template<size_t I, class T, T... Values>
+//   struct tuple_element<I, integer_sequence<T, Values...>>;
+// template<size_t I, class T, T... Values>
+//   struct tuple_element<I, const integer_sequence<T, Values...>>;
+// template<size_t I, class T, T... Values>
+//   constexpr T get(integer_sequence<T, Values...>) noexcept;
+
+#include <cassert>
+#include <utility>
+
+void test_structured_bindings() {
+  auto [elt0, elt1, elt2, elt3] = std::make_index_sequence<4>();
+  
+  assert(elt0 == 0);
+  assert(elt1 == 1);
+  assert(elt2 == 2);
+  assert(elt3 == 3);
+}
+
+#if __cpp_structured_bindings >= 202411L
----------------
frederick-vs-ja wrote:

> As in eventually remove the check against the feature test macro entirely?

Yes. We're testing this only since C++26, so structured binding packs should be ideally usable.

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


More information about the libcxx-commits mailing list