brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 8632300 Raw
39 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++17, c++2010 11// constexpr iterator& operator++();12// constexpr void operator++(int);13 14#include <ranges>15#include <concepts>16#include <cassert>17 18constexpr bool test() {19  using Iter = std::ranges::iterator_t<std::ranges::repeat_view<int>>;20  std::ranges::repeat_view<int> rv(10);21  using Iter = std::ranges::iterator_t<std::ranges::repeat_view<int>>;22  auto iter  = rv.begin();23 24  assert(iter++ == rv.begin());25  assert(++iter == rv.begin() + 2);26 27  static_assert(std::same_as<decltype(iter++), Iter>);28  static_assert(std::same_as<decltype(++iter), Iter&>);29 30  return true;31}32 33int main(int, char**) {34  test();35  static_assert(test());36 37  return 0;38}39