NiHu  2.0
relation.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 
27 #ifndef RELATION_HPP_INCLUDED
28 #define RELATION_HPP_INCLUDED
29 
30 #include <type_traits>
31 
32 namespace tmp
33 {
41  template <class N, class M> struct less;
42 
51  template <class N, class M> struct greater;
52 
62  template <class Val, class...Args>
63  struct max_ : max_<Val, typename max_<Args...>::type> {};
64 
72  template <class Val1, class Val2>
73  struct max_<Val1, Val2> : std::conditional<
74  greater<Val1, Val2>::value,
75  Val1, Val2
76  > {};
77 
87  template <class Val, class...Args>
88  struct min_ : min_<Val, typename min_<Args...>::type> {};
89 
97  template <class Val1, class Val2>
98  struct min_<Val1, Val2> : std::conditional<
99  less<Val1, Val2>::value,
100  Val1, Val2
101  > {};
102 }
103 
104 #endif /* RELATION_HPP_INCLUDED */
tmp::less
General declaration of the less oparation.
Definition: relation.hpp:41
tmp::min_
Compute minimum of types.
Definition: relation.hpp:88
tmp::greater
General declaration of the greater oparation.
Definition: relation.hpp:51
tmp
template metaprogramming functions
Definition: asymptotic_types.hpp:101
tmp::max_
Compute maximum of types.
Definition: relation.hpp:63