• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // UNSUPPORTED: c++98, c++03, c++11
11 // <experimental/type_traits>
12 
13 // template<class B> struct negation;
14 // template<class B>
15 //   constexpr bool negation_v = negation<B>::value;
16 
17 #include <experimental/type_traits>
18 #include <cassert>
19 
20 namespace ex = std::experimental;
21 
22 struct True  { static constexpr bool value = true; };
23 struct False { static constexpr bool value = false; };
24 
main()25 int main()
26 {
27     static_assert (!ex::negation<std::true_type >::value, "" );
28     static_assert ( ex::negation<std::false_type>::value, "" );
29 
30     static_assert (!ex::negation_v<std::true_type >, "" );
31     static_assert ( ex::negation_v<std::false_type>, "" );
32 
33     static_assert (!ex::negation<True >::value, "" );
34     static_assert ( ex::negation<False>::value, "" );
35 
36     static_assert (!ex::negation_v<True >, "" );
37     static_assert ( ex::negation_v<False>, "" );
38 
39     static_assert ( ex::negation<ex::negation<std::true_type >>::value, "" );
40     static_assert (!ex::negation<ex::negation<std::false_type>>::value, "" );
41 }
42