
In article <3fc901c337d4$5821a420$8d6c6f50@pc>, Terje Slettebø <tslettebo@chello.no> wrote: | Granted, this doesn't appear use SFINAE, though, so maybe leave it out. Your conversion operator example worked fine for me. test<int> converted to double, but not to std::string. | On | the other hand, does constructors? I get the same kind of error message for | both constructors and conversion operators, on both Intel C++ and g++: | | template<class T> | class test | { | public: | test(const T &, | typename enable_if< | is_arithmetic<T>::value, | T | >::type * = 0) {} | }; | | test a(1); // Ok | | test b(0 (int *) 0); // error: class "enable_if<false, int *>" has no member | "type" Maybe you meant: class test { public: template<class T> test(const T &, typename enable_if<is_arithmetic<T>::value>::type* = 0) {} }; int main () { test a(1); test b((int*)0); } And yes, test b is an error. If you want to make test b not an error, then you must add a ctor to accept it: test(int*) {} -- Howard Hinnant Metrowerks