[clang-tools-extra] [libcxx] [flang] [compiler-rt] [clang] [lld] [llvm] [libc++][ranges] P2116R9: Implements `views::enumerate` (PR #73617)

Christopher Di Bella via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 2 14:17:01 PST 2024


================
@@ -0,0 +1,333 @@
+// -*- 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_ENUMERATE_VIEW_H
+#define _LIBCPP___RANGES_ENUMERATE_VIEW_H
+
+#include <__concepts/convertible_to.h>
+#include <__config>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/iter_move.h>
+#include <__iterator/iterator_traits.h>
+#include <__ranges/access.h>
+#include <__ranges/all.h>
+#include <__ranges/concepts.h>
+#include <__ranges/enable_borrowed_range.h>
+#include <__ranges/range_adaptor.h>
+#include <__ranges/size.h>
+#include <__ranges/view_interface.h>
+#include <__type_traits/maybe_const.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+#include <tuple>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+
+// [concept.object]
+
+template <class _Rp>
+concept __range_with_movable_references =
+    ranges::input_range<_Rp> && std::move_constructible<ranges::range_reference_t<_Rp>> &&
+    std::move_constructible<ranges::range_rvalue_reference_t<_Rp>>;
----------------
cjdb wrote:

```suggestion
template <class _Rp>
concept __range_with_movable_references =
   input_range<_Rp> && move_constructible<range_reference_t<_Rp>> &&
   move_constructible<range_rvalue_reference_t<_Rp>>;
```
We don't need to qualify these names in their native namespace.

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


More information about the cfe-commits mailing list