brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · ce3f46d Raw
58 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// friend constexpr bool operator==(const iterator& x, const sentinel& y);12 13#include <ranges>14#include <cassert>15 16#include "test_macros.h"17#include "../types.h"18 19constexpr bool test() {20  {21    const std::ranges::iota_view<int, IntComparableWith<int>> io(0, IntComparableWith<int>(10));22    auto iter = io.begin();23    auto sent = io.end();24    assert(iter != sent);25    assert(iter + 10 == sent);26  }27  {28    std::ranges::iota_view<int, IntComparableWith<int>> io(0, IntComparableWith<int>(10));29    auto iter = io.begin();30    auto sent = io.end();31    assert(iter != sent);32    assert(iter + 10 == sent);33  }34  {35    const std::ranges::iota_view io(SomeInt(0), IntComparableWith(SomeInt(10)));36    auto iter = io.begin();37    auto sent = io.end();38    assert(iter != sent);39    assert(iter + 10 == sent);40  }41  {42    std::ranges::iota_view io(SomeInt(0), IntComparableWith(SomeInt(10)));43    auto iter = io.begin();44    auto sent = io.end();45    assert(iter != sent);46    assert(iter + 10 == sent);47  }48 49  return true;50}51 52int main(int, char**) {53  test();54  static_assert(test());55 56  return 0;57}58