C++ type traits to select between T1 and T2
问题 I want a template to select from two types based on some condition. E.g. struct Base {}; template <typename T1, typename T2> struct test { // e.g. here it should select T1/T2 that is_base_of<Base> typename select_base<T1, T2>::type m_ValueOfBaseType; }; Of course to pass condition to the select_base (to make it generic) would be useful, but hard-coded solution is easier and good as well. Here's a sample solution that I tried but it always selects T1: http://ideone.com/EnVT8 The question is