Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / ranges / range.factories / range.single.view / ctor.default.pass.cpp
blob986ebffcd8f53fea0d0eec5c208ce0b7ee4f9add
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 // single_view() requires default_initializable<T> = default;
13 #include <ranges>
14 #include <cassert>
16 #include "test_macros.h"
18 struct BigType { char buffer[64] = {10}; };
20 template<bool DefaultCtorEnabled>
21 struct IsDefaultConstructible {
22 IsDefaultConstructible() requires DefaultCtorEnabled = default;
25 constexpr bool test() {
26 static_assert( std::default_initializable<std::ranges::single_view<IsDefaultConstructible<true>>>);
27 static_assert(!std::default_initializable<std::ranges::single_view<IsDefaultConstructible<false>>>);
30 std::ranges::single_view<BigType> sv;
31 assert(sv.data()->buffer[0] == 10);
32 assert(sv.size() == 1);
35 const std::ranges::single_view<BigType> sv;
36 assert(sv.data()->buffer[0] == 10);
37 assert(sv.size() == 1);
40 return true;
43 int main(int, char**) {
44 test();
45 static_assert(test());
47 return 0;