uTL
micro Template library
selection.h
Go to the documentation of this file.
1 
20 #ifndef __utl_meta_selection_h__
21 #define __utl_meta_selection_h__
22 
23 #include <utl/core/impl.h>
24 #include <utl/meta/integral.h>
25 
31 namespace utl {
33 namespace meta{
34 
38 
42  namespace detail {
43  template <bool If, typename...>
44  struct if_c_ {
45  using type = nil_;
46  };
47  template<typename Then>
49  using type = Then;
50  };
51  template<typename Then, typename Else>
53  using type = Then;
54  };
55  template<typename Then, typename Else>
57  using type = Else;
58  };
59  }
61  template <bool B, typename... Args>
62  using if_c = eval<detail::if_c_<B, Args...>>;
63 
65  template <typename If, typename... Args>
66  using if_ = if_c<If::type::value, Args...>;
67 
69 
73 
76  template <typename T1, typename ...> using first_of = T1;
77 
79  template <typename T1, typename T2, typename ...> using second_of = T2;
80 
82 }}
83 
85 
86 #endif /* __utl_meta_selection_h__ */
T1 first_of
Select the first type of a type sequence.
Definition: selection.h:76
if_c< If::type::value, Args... > if_
Select one type or another depending on a compile-time Boolean type.
Definition: selection.h:66
eval< detail::if_c_< B, Args... > > if_c
Select one type or another depending on a compile-time Boolean.
Definition: selection.h:62
T2 second_of
Select the second type of a type sequence.
Definition: selection.h:79
typename Tp::type eval
Type alias for Tp::type. Used to evaluate/extract return type of metafunctions.
Definition: integral.h:49
STL&#39;s core language concepts.
Definition: _1wire.h:30
Implementation detail main forward header.