[libcxx-commits] [libcxx] [libc++][ranges] LWG4001: `iota_view` should provide `empty` (PR #79687)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 15 08:34:31 PDT 2024


================
@@ -0,0 +1,157 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 HasEmpty = requires(R r) {
----------------
ldionne wrote:

```suggestion
concept HasEmpty = requires(R const r) {
```

Otherwise you don't test anywhere that the method is marked as `const`.

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


More information about the libcxx-commits mailing list