You'll often want to use forwarding reference types and not T const& in your generic interfaces. This preserves value category and cv-qualification, which is important since the side-effects & value of an expression can completely change with those properties.
good call: it isn't. and the program would not compile had it happened.
but, as of C++14, decltype(&T::count) fails for all three types provided. It fails for array and vector because they have no such member, and it fails for set because it has more than one such member. So there was never any overloading, only the second, false-returning, function template.
If you compile with gcc/clang -std=c++11, then you get the overloading and the expected
rror: call of overloaded 'has_count(std::set<int>&)' is ambiguous
it fails for set because it has more than one such member
Oh crud. Should have read the diagnostics and the docs more carefully. That was dumb.
In my defense, I was barely conscious...
This has set me on the right track: because count() is overloaded, all my efforts with SFINAE so far have failed, because they all worked by taking the address of the function...