38 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710 11// constexpr sentinel_t<Base> base() const;12 13#include <ranges>14#include <cassert>15 16#include "test_macros.h"17#include "test_iterators.h"18#include "../types.h"19 20constexpr bool test() {21 int buffer[8] = {1, 2, 3, 4, 5, 6, 7, 8};22 {23 std::ranges::take_view<MoveOnlyView> tv(MoveOnlyView(buffer), 4);24 std::same_as<sentinel_wrapper<int*>> auto sw1 = tv.end().base();25 assert(base(sw1) == buffer + 8);26 std::same_as<sentinel_wrapper<int*>> auto sw2 = std::as_const(tv).end().base();27 assert(base(sw2) == buffer + 8);28 }29 return true;30}31 32int main(int, char**) {33 test();34 static_assert(test());35 36 return 0;37}38