|
Boost : |
From: Dmitry Ivankov (divanorama_at_[hidden])
Date: 2007-01-21 02:26:34
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
:) )
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk