brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 4493060 Raw
51 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// <ranges>12 13// std::ranges::chunk_by_view<V>::<iterator>() = default;14 15#include <ranges>16 17#include <cassert>18#include <functional>19#include <type_traits>20#include <utility>21 22#include "../types.h"23#include "test_iterators.h"24 25template <class Iterator, bool IsNoexcept>26constexpr void testDefaultConstructible() {27  // Make sure the iterator is default constructible.28  using ChunkByView     = std::ranges::chunk_by_view<View<Iterator>, std::ranges::less_equal>;29  using ChunkByIterator = std::ranges::iterator_t<ChunkByView>;30  ChunkByIterator i{};31  ChunkByIterator j;32  assert(i == j);33  static_assert(noexcept(ChunkByIterator{}) == IsNoexcept);34}35 36constexpr bool tests() {37  testDefaultConstructible<forward_iterator<int*>, /*IsNoexcept=*/false>();38  testDefaultConstructible<bidirectional_iterator<int*>, /*IsNoexcept=*/false>();39  testDefaultConstructible<random_access_iterator<int*>, /*IsNoexcept=*/false>();40  testDefaultConstructible<contiguous_iterator<int*>, /*IsNoexcept=*/false>();41  testDefaultConstructible<int*, /*IsNoexcept=*/true>();42  return true;43}44 45int main(int, char**) {46  tests();47  static_assert(tests());48 49  return 0;50}51