================ @@ -0,0 +1,114 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// <ranges> + +// class enumerate_view + +// constexpr auto end() requires (!simple-view<V>); +// constexpr auto end() const requires range-with-movable-references<const V>; + +#include <cassert> +#include <concepts> +#include <ranges> + +#include "test_iterators.h" +#include "types.h" + +constexpr bool test() { + int buff[] = {1, 2, 3, 4, 5, 6, 7, 8}; + + // Check the return type of .end() + { + RangeView range(buff, buff + 1); + + std::ranges::enumerate_view view(range); + using Iterator = std::ranges::iterator_t<decltype(view)>; + static_assert(std::same_as<Iterator, decltype(view.end())>); + using Sentinel = std::ranges::sentinel_t<decltype(view)>; + static_assert(std::same_as<Sentinel, decltype(view.end())>); + } + + // Check the return type of .end() const + { + RangeView range(buff, buff + 1); + + const std::ranges::enumerate_view view(range); + using Iterator = std::ranges::iterator_t<decltype(view)>; + static_assert(std::same_as<Iterator, decltype(view.end())>); + using Sentinel = std::ranges::sentinel_t<decltype(view)>; + static_assert(std::same_as<Sentinel, decltype(view.end())>); + } ---------------- cjdb wrote:
This feels like it's testing `ranges::iterator_t` and `ranges::sentinel_t` more than anything in `enumerate_view`. I think we can remove it, or at least condense it to checking that we have a common range in both cases. https://github.com/llvm/llvm-project/pull/73617 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits