[libcxx-commits] [libcxx] [libc++] Implement `adjacent_transform` (PR #168208)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Dec 20 07:05:24 PST 2025


================
@@ -0,0 +1,411 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___RANGES_ADJACENT_TRANSFORM_VIEW_H
+#define _LIBCPP___RANGES_ADJACENT_TRANSFORM_VIEW_H
+
+#include <__config>
+
+#include <__algorithm/min.h>
+#include <__compare/three_way_comparable.h>
+#include <__concepts/constructible.h>
+#include <__concepts/convertible_to.h>
+#include <__concepts/equality_comparable.h>
+#include <__cstddef/size_t.h>
+#include <__functional/invoke.h>
+#include <__functional/operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/incrementable_traits.h>
+#include <__iterator/iter_move.h>
+#include <__iterator/iter_swap.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/next.h>
+#include <__iterator/prev.h>
+#include <__memory/addressof.h>
+#include <__ranges/access.h>
+#include <__ranges/adjacent_view.h>
+#include <__ranges/all.h>
+#include <__ranges/concepts.h>
+#include <__ranges/empty_view.h>
+#include <__ranges/movable_box.h>
+#include <__ranges/range_adaptor.h>
+#include <__ranges/size.h>
+#include <__ranges/view_interface.h>
+#include <__ranges/zip_transform_view.h>
+#include <__ranges/zip_utils.h>
+#include <__type_traits/common_type.h>
+#include <__type_traits/is_nothrow_constructible.h>
+#include <__type_traits/is_referenceable.h>
+#include <__type_traits/make_unsigned.h>
+#include <__type_traits/maybe_const.h>
+#include <__utility/declval.h>
+#include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/integer_sequence.h>
+#include <__utility/move.h>
+#include <concepts>
+#include <ranges>
+#include <tuple>
+#include <type_traits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+
+template <class _Fn, size_t _Np>
+struct __apply_n {
+  template <class... _Ts>
+  static auto __apply(tuple<_Ts...>&&) -> invoke_result_t<_Fn, _Ts...>;
+
+  template <class _Tp, size_t... _Is>
+  static auto __make_tuple_impl(index_sequence<_Is...>) -> tuple<decltype((_Is, std::declval<_Tp (*)()>()()))...>;
+
+  template <class _Tp>
+  static constexpr auto operator()(_Tp&&) -> decltype(__apply(__make_tuple_impl<_Tp&&>(make_index_sequence<_Np>{})));
----------------
huixie90 wrote:

well. let me put it in another way. the compiler that we support on the Apple platform has this bug and we need to continue support it unless we remove it from the CI

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


More information about the libcxx-commits mailing list