Tapkee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
conditional_select.hpp
Go to the documentation of this file.
1 /* This software is distributed under BSD 3-clause license (see LICENSE file).
2  *
3  * Copyright (c) 2012-2013 Sergey Lisitsyn, Fernando Iglesias
4  */
5 
6 #ifndef TAPKEE_CONDITIONAL_SELECT_H_
7 #define TAPKEE_CONDITIONAL_SELECT_H_
8 
9 namespace tapkee
10 {
11 namespace tapkee_internal
12 {
13 
14 template<bool, typename T>
16 {
17  inline T operator()(T a, T b) const;
18 };
19 
20 template<typename T>
21 struct conditional_select<true,T>
22 {
23  inline T operator()(T a, T) const
24  {
25  return a;
26  }
27 };
28 
29 template<typename T>
30 struct conditional_select<false,T>
31 {
32  inline T operator()(T, T b) const
33  {
34  return b;
35  }
36 };
37 
38 }
39 }
40 
41 #endif