
Hello again! See the example below. (Platform: VC++7.1) This error is strange for me because it only occurs in the case of class template specialization. The compiler deduces the type of is_arithmetic<T>::value falsely, not as bool, althought it is known at compile time, isn't it? The error messages (both referring to the erroneous line marked with "ERROR"): error C2296: '&&' : illegal, left operand has type 'is_arithmetic<T>::value' error C2297: '&&' : illegal, right operand has type 'is_arithmetic<T2>::value' Thx, Agoston Example: //------------------------------------------------------- #include <iostream> #include <boost/utility/enable_if.hpp> #include <boost/type_traits.hpp> #include <boost/mpl/and.hpp> using namespace std; using namespace boost; using namespace mpl; // ----------------- template<typename T1, typename T2, typename TEnabler = void> struct Enabler { static const bool value = false; }; template<typename T1, typename T2> struct Enabler<T1, T2, typename enable_if_c< is_arithmetic<T1>::value && is_arithmetic<T2>::value
::type
// ERROR!!!
{ static const bool value = true; }; */ /* //WOULD WORK: typename enable_if< and_< is_arithmetic<T1>, is_arithmetic<T2> >
::type */
// ----------------- template<typename T1, typename T2> typename enable_if_c< is_arithmetic<T1>::value && is_arithmetic<T2>::value
::type f(T1 t1, T2 t2) { cout << t1 << " " << t2 << endl; }
// ----------------- int _tmain(int argc, _TCHAR* argv[]) { f(5.0, 6); return 0; }