NiHu  2.0
bool.hpp
Go to the documentation of this file.
1 // This file is a part of NiHu, a C++ BEM template library.
2 //
3 // Copyright (C) 2012-2014 Peter Fiala <fiala@hit.bme.hu>
4 // Copyright (C) 2012-2014 Peter Rucz <rucz@hit.bme.hu>
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
31 #ifndef BOOL_HPP_INCLUDED
32 #define BOOL_HPP_INCLUDED
33 
34 #include <type_traits>
35 
36 namespace tmp
37 {
43  template <class A>
44  struct not_ : std::integral_constant<bool, !A::value> {};
45 
53  template <class...Args>
54  struct or_ : std::false_type {};
55 
63  template <class...Args>
64  struct or_<std::false_type, Args...> : or_<Args...> {};
65 
73  template <class...Args>
74  struct or_<std::true_type, Args...> : std::true_type {};
75 
83  template <class...Args>
84  struct and_ : std::false_type {};
85 
93  template <>
94  struct and_<std::true_type> : std::true_type {};
95 
103  template <class...Args>
104  struct and_<std::true_type, Args...> : and_<Args...> {};
105 
113  template <class...Args>
114  struct and_<std::false_type, Args...> : std::false_type {};
115 
116 }
117 
118 #endif /* BOOL_HPP_INCLUDED */
119 
tmp
template metaprogramming functions
Definition: asymptotic_types.hpp:101
tmp::and_
Conjunction of boolean constants.
Definition: bool.hpp:84
tmp::or_
Disjunction of Boolean constants.
Definition: bool.hpp:54
tmp::not_
Boolean negation.
Definition: bool.hpp:44