
21 Jan
2007
21 Jan
'07
7:26 a.m.
And here goes workaround: Wrap invalid type into another template. So that type can't be detected until helper is instantiated. class A { public: virtual void foo() = 0; }; template<class T> class limits_static_functor_helper; //should have public T operator() const template<class T> struct limits { static int const value = true; // static T declared_only(); typedef limits_static_functor_helper<T> declared_only; }; int main() { limits<A>::value; } P.S. maybe it should be not typedef but static member (both works ok), or functor should have static member, instead of non-static operator. It all depend on perfomance, usage, and so on (just i haven't used limits.hpp before :) )