//===----------------------------------------------------------------------===// // // 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 // constexpr auto size() const requires (!same_as); #include #include #include #include template concept has_size = requires(T&& view) { { std::forward(view).size() }; }; static_assert(has_size>); static_assert(!has_size>); static_assert(!has_size>); constexpr bool test() { { std::ranges::repeat_view rv(10, 20); assert(rv.size() == 20); } { constexpr int int_max = std::numeric_limits::max(); std::ranges::repeat_view rv(10, int_max); assert(rv.size() == int_max); } return true; } int main(int, char**) { test(); static_assert(test()); return 0; }