Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / ranges / range.factories / range.iota.view / ctad.compile.pass.cpp
blobe14a23536d3605a3941cfe0ed9bb78f780dc87c7
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-exception
6 //
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>;
16 #include <ranges>
17 #include <cassert>
18 #include <concepts>
20 #include "test_macros.h"
21 #include "types.h"
23 template<class T, class U>
24 concept CanDeduce = requires(const T& t, const U& u) {
25 std::ranges::iota_view(t, u);
28 void test() {
29 static_assert(std::same_as<
30 decltype(std::ranges::iota_view(0, 0)),
31 std::ranges::iota_view<int, int>
32 >);
34 static_assert(std::same_as<
35 decltype(std::ranges::iota_view(0)),
36 std::ranges::iota_view<int, std::unreachable_sentinel_t>
37 >);
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>
42 >);
44 static_assert(std::same_as<
45 decltype(std::ranges::iota_view(0, IntComparableWith(0))),
46 std::ranges::iota_view<int, IntComparableWith<int>>
47 >);
49 static_assert( CanDeduce<int, int>);
50 static_assert(!CanDeduce<int, unsigned>);
51 static_assert(!CanDeduce<unsigned, int>);