Tapkee
conditional_select.hpp
Go to the documentation of this file.
00001 /* This software is distributed under BSD 3-clause license (see LICENSE file).
00002  *
00003  * Copyright (c) 2012-2013 Sergey Lisitsyn, Fernando Iglesias
00004  */
00005 
00006 #ifndef TAPKEE_CONDITIONAL_SELECT_H_
00007 #define TAPKEE_CONDITIONAL_SELECT_H_
00008 
00009 namespace tapkee
00010 {
00011 namespace tapkee_internal
00012 {
00013 
00014 template<bool, typename T>
00015 struct conditional_select
00016 {
00017     inline T operator()(T a, T b) const;
00018 };
00019 
00020 template<typename T>
00021 struct conditional_select<true,T>
00022 {
00023     inline T operator()(T a, T) const
00024     {
00025         return a;
00026     }
00027 };
00028 
00029 template<typename T>
00030 struct conditional_select<false,T>
00031 {
00032     inline T operator()(T, T b) const
00033     {
00034         return b;
00035     }
00036 };
00037 
00038 }
00039 }
00040 
00041 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines