Debian Codegraph @

libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp

raw
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 //===----------------------------------------------------------------------===//
8
9 // <functional>
10
11 // unary_negate
12
13 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS
14 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
15 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
16
17 #include <functional>
18 #include <type_traits>
19 #include <cassert>
20
21 #include "test_macros.h"
22
23 int main(int, char**)
24 {
25 typedef std::unary_negate<std::logical_not<int> > F;
26 const F f = F(std::logical_not<int>());
27 static_assert((std::is_same<F::argument_type, int>::value), "" );
28 static_assert((std::is_same<F::result_type, bool>::value), "" );
29 assert(f(36));
30 assert(!f(0));
31
32 return 0;
33 }