use sfinae to test namespace members existence
I was trying to figure out if it is possible to use sfinae to test namespace member existence. Google is rather silent about it. I've tried the following code, but it fails. namespace xyz{ struct abc{}; } struct abc{}; struct test_xyz{ typedef char yes; typedef struct{ char a[2]; } no; template <class C> static yes test(xyz::C = xyz::C()); //lets assume it has default constructor template <class C> static no test(...); const bool has_abc = sizeof(test_xyz::test<abc>()) == sizeof(yes); }; Any idea why? Regards, No, that won't work. There is also no way to use SFINAE in such a way (this was last