[libcxx-commits] [libcxx] [libc++][ranges] implement `ranges::elements_of` (PR #91414)
Xiaoyang Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 27 18:32:44 PDT 2024
================
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+// 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, c++14, c++17, c++20
+
+// std::ranges::elements_of;
+
+#include <ranges>
+
+#include <memory>
+#include <type_traits>
+#include <vector>
+
+#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_iterators.h"
+
+template <class Iterator>
+struct Range {
+ using Sentinel = sentinel_wrapper<Iterator>;
+
+ Iterator begin() { return Iterator(data_.data()); }
+
+ sentinel_wrapper<Iterator> end() { return Sentinel(Iterator(data_.data() + data_.size())); }
+
+private:
+ std::vector<int> data_ = {0, 1, 2, 3};
+};
+
+template <class Range, class Allocator>
+constexpr bool test_range() {
+ Range r;
+
+ using elements_of_t = std::ranges::elements_of<Range&, Allocator>;
+ {
+ // constructor
+ std::same_as<elements_of_t> decltype(auto) elements_of = std::ranges::elements_of(r, Allocator());
----------------
xiaoyang-sde wrote:
It appears that the version of Clang used for the Android builds hasn't implemented P1816R0.
https://github.com/llvm/llvm-project/pull/91414
More information about the libcxx-commits
mailing list