• 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 disjunction;
14 // template<class... B>
15 //   constexpr bool disjunction_v = disjunction<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::disjunction<>::value, "" );
28     static_assert ( ex::disjunction<std::true_type >::value, "" );
29     static_assert (!ex::disjunction<std::false_type>::value, "" );
30 
31     static_assert (!ex::disjunction_v<>, "" );
32     static_assert ( ex::disjunction_v<std::true_type >, "" );
33     static_assert (!ex::disjunction_v<std::false_type>, "" );
34 
35     static_assert ( ex::disjunction<std::true_type,  std::true_type >::value, "" );
36     static_assert ( ex::disjunction<std::true_type,  std::false_type>::value, "" );
37     static_assert ( ex::disjunction<std::false_type, std::true_type >::value, "" );
38     static_assert (!ex::disjunction<std::false_type, std::false_type>::value, "" );
39 
40     static_assert ( ex::disjunction_v<std::true_type,  std::true_type >, "" );
41     static_assert ( ex::disjunction_v<std::true_type,  std::false_type>, "" );
42     static_assert ( ex::disjunction_v<std::false_type, std::true_type >, "" );
43     static_assert (!ex::disjunction_v<std::false_type, std::false_type>, "" );
44 
45     static_assert ( ex::disjunction<std::true_type,  std::true_type,  std::true_type >::value, "" );
46     static_assert ( ex::disjunction<std::true_type,  std::false_type, std::true_type >::value, "" );
47     static_assert ( ex::disjunction<std::false_type, std::true_type,  std::true_type >::value, "" );
48     static_assert ( ex::disjunction<std::false_type, std::false_type, std::true_type >::value, "" );
49     static_assert ( ex::disjunction<std::true_type,  std::true_type,  std::false_type>::value, "" );
50     static_assert ( ex::disjunction<std::true_type,  std::false_type, std::false_type>::value, "" );
51     static_assert ( ex::disjunction<std::false_type, std::true_type,  std::false_type>::value, "" );
52     static_assert (!ex::disjunction<std::false_type, std::false_type, std::false_type>::value, "" );
53 
54     static_assert ( ex::disjunction_v<std::true_type,  std::true_type,  std::true_type >, "" );
55     static_assert ( ex::disjunction_v<std::true_type,  std::false_type, std::true_type >, "" );
56     static_assert ( ex::disjunction_v<std::false_type, std::true_type,  std::true_type >, "" );
57     static_assert ( ex::disjunction_v<std::false_type, std::false_type, std::true_type >, "" );
58     static_assert ( ex::disjunction_v<std::true_type,  std::true_type,  std::false_type>, "" );
59     static_assert ( ex::disjunction_v<std::true_type,  std::false_type, std::false_type>, "" );
60     static_assert ( ex::disjunction_v<std::false_type, std::true_type,  std::false_type>, "" );
61     static_assert (!ex::disjunction_v<std::false_type, std::false_type, std::false_type>, "" );
62 
63     static_assert ( ex::disjunction<True >::value, "" );
64     static_assert (!ex::disjunction<False>::value, "" );
65 
66     static_assert ( ex::disjunction_v<True >, "" );
67     static_assert (!ex::disjunction_v<False>, "" );
68 }
69