metaprogramming/conditional/conditional-def.cc - Possible definition of conditional - here as my_conditional. | Lecture 6 - slide 34 : 40 Program 4 |
// Possible definition of conditional - here as my_conditional - in file conditional-def.cc // The standard library definition is in <type_traits> template<bool C, typename T, typename F> // Template, catching all other cases than the struct my_conditional { // specialization (below). using type = T; }; template<typename T, typename F> // Template specialization, for the false branch. struct my_conditional <false, T, F>{ using type = F; };