Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / utilities / any / any.nonmembers / swap.pass.cpp
blob0abed9998520ae76ff97964c45dd264c8eda6e5a
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
11 // <any>
13 // void swap(any &, any &) noexcept
15 // swap(...) just wraps any::swap(...). That function is tested elsewhere.
17 #include <any>
18 #include <cassert>
20 #include "test_macros.h"
22 int main(int, char**)
25 { // test noexcept
26 std::any a;
27 static_assert(noexcept(swap(a, a)), "swap(any&, any&) must be noexcept");
30 std::any a1 = 1;
31 std::any a2 = 2;
33 swap(a1, a2);
35 assert(std::any_cast<int>(a1) == 2);
36 assert(std::any_cast<int>(a2) == 1);
39 return 0;