//===----------------------------------------------------------------------===// // // 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 // UNSUPPORTED: libcpp-no-concepts // UNSUPPORTED: libcpp-has-no-incomplete-ranges // constexpr sentinel end(); // constexpr iterator end() requires common_range; // constexpr sentinel end() const // requires range && // regular_invocable>; // constexpr iterator end() const // requires common_range && // regular_invocable>; #include #include "test_macros.h" #include "types.h" template concept EndInvocable = requires(T t) { t.end(); }; template concept EndIsIter = requires(T t) { ++t.end(); }; constexpr bool test() { { std::ranges::transform_view transformView(ContiguousView{}, PlusOneMutable{}); assert(transformView.end().base() == globalBuff + 8); } { std::ranges::transform_view transformView(ForwardView{}, PlusOneMutable{}); assert(transformView.end().base().base() == globalBuff + 8); } { std::ranges::transform_view transformView(InputView{}, PlusOneMutable{}); assert(transformView.end().base() == globalBuff + 8); } { const std::ranges::transform_view transformView(ContiguousView{}, PlusOne{}); assert(transformView.end().base() == globalBuff + 8); } static_assert(!EndInvocable>); static_assert( EndInvocable< std::ranges::transform_view>); static_assert( EndInvocable>); static_assert(!EndInvocable>); static_assert( EndInvocable< std::ranges::transform_view>); static_assert( EndInvocable>); static_assert(!EndIsIter>); static_assert(!EndIsIter< std::ranges::transform_view>); static_assert( EndIsIter>); static_assert( EndIsIter< std::ranges::transform_view>); return true; } int main(int, char**) { test(); static_assert(test()); return 0; }