[libcxx-commits] [libcxx] [libc++][ranges] LWG3715: `view_interface::empty` is overconstrained (PR #85004)
Xiaoyang Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 13 00:16:14 PDT 2024
================
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// LWG 3715: `view_interface::empty` is overconstrained
+
+#include <cassert>
+#include <ranges>
+#include <sstream>
+
+bool test() {
+ std::istringstream input("1 2 3 4 5");
+ auto i = std::views::istream<int>(input);
+ auto r = std::views::counted(i.begin(), 4) | std::views::take(2);
+ static_assert(std::ranges::input_range<decltype(r)>);
+ static_assert(!std::ranges::forward_range<decltype(r)>);
+ static_assert(std::ranges::sized_range<decltype(r)>);
+ assert(!r.empty());
+ return true;
+}
+
+int main(int, char**) {
+ test();
----------------
xiaoyang-sde wrote:
Thanks for the comments! I've removed this file and followed the structure of `view.interface.pass.cpp` to write corresponding test cases.
https://github.com/llvm/llvm-project/pull/85004
More information about the libcxx-commits
mailing list