[libcxx-commits] [libcxx] [libc++][ranges] LWG4001: `iota_view` should provide `empty` (PR #79687)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 2 06:42:20 PDT 2024
================
@@ -0,0 +1,136 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// constexpr bool empty() const;
+
+#include <cassert>
+#include <concepts>
+#include <ranges>
+#include <utility>
+#include <vector>
+
+#include "types.h"
+
+template <typename R>
+concept HasFreeEmpty = requires(R r) { std::ranges::empty(r); };
+
+template <typename R>
+concept HasMemberEmpty = requires(R r) {
+ { r.empty() } -> std::same_as<bool>;
+};
+
+constexpr void test_empty_iota() {
+ std::vector<int> ev;
----------------
H-G-Hristov wrote:
Normally I prefer long descriptive names but the libc++ tests use short names, so I try to be consistent:
ev -> empty vector vs v -> non-empty vector.
iv -> iota_view
I can change these.
https://github.com/llvm/llvm-project/pull/79687
More information about the libcxx-commits
mailing list