1 //===----------------------------------------------------------------------===//
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-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // template<class W, class Bound>
12 // requires (!is-integer-like<W> || !is-integer-like<Bound> ||
13 // (is-signed-integer-like<W> == is-signed-integer-like<Bound>))
14 // iota_view(W, Bound) -> iota_view<W, Bound>;
20 #include "test_macros.h"
23 template<class T
, class U
>
24 concept CanDeduce
= requires(const T
& t
, const U
& u
) {
25 std::ranges::iota_view(t
, u
);
29 static_assert(std::same_as
<
30 decltype(std::ranges::iota_view(0, 0)),
31 std::ranges::iota_view
<int, int>
34 static_assert(std::same_as
<
35 decltype(std::ranges::iota_view(0)),
36 std::ranges::iota_view
<int, std::unreachable_sentinel_t
>
39 static_assert(std::same_as
<
40 decltype(std::ranges::iota_view(0, std::unreachable_sentinel
)),
41 std::ranges::iota_view
<int, std::unreachable_sentinel_t
>
44 static_assert(std::same_as
<
45 decltype(std::ranges::iota_view(0, IntComparableWith(0))),
46 std::ranges::iota_view
<int, IntComparableWith
<int>>
49 static_assert( CanDeduce
<int, int>);
50 static_assert(!CanDeduce
<int, unsigned>);
51 static_assert(!CanDeduce
<unsigned, int>);