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.value.pass.cpp
blobc09fd52dba8cbcd7e84fede0e633e9568e6e9e56
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 // constexpr explicit single_view(const T& t);
12 // constexpr explicit single_view(T&& t);
14 #include <cassert>
15 #include <ranges>
16 #include <utility>
18 #include "test_macros.h"
20 struct Empty {};
21 struct BigType { char buffer[64] = {10}; };
23 constexpr bool test() {
25 BigType bt;
26 std::ranges::single_view<BigType> sv(bt);
27 assert(sv.data()->buffer[0] == 10);
28 assert(sv.size() == 1);
31 const BigType bt;
32 const std::ranges::single_view<BigType> sv(bt);
33 assert(sv.data()->buffer[0] == 10);
34 assert(sv.size() == 1);
38 BigType bt;
39 std::ranges::single_view<BigType> sv(std::move(bt));
40 assert(sv.data()->buffer[0] == 10);
41 assert(sv.size() == 1);
44 const BigType bt;
45 const std::ranges::single_view<BigType> sv(std::move(bt));
46 assert(sv.data()->buffer[0] == 10);
47 assert(sv.size() == 1);
50 return true;
53 int main(int, char**) {
54 test();
55 static_assert(test());
57 return 0;