22 Jul
2007
22 Jul
'07
4:08 a.m.
Hi,
Is there a way, using SFINAE tricks and potentially the techniques
used in the Boost Concept Check Library, to detect at compile-time if
a type T supports a certain expression? In my case, I'm interested if
T supports operator ==. So I'm basically looking for a compile-time
predicate so that this compiles:
struct my_struct { int i; };
struct my_struct2 { int i; };
bool operator == (my_struct2 const&, my_struct2 const&) const;
BOOST_STATIC_ASSERT((supports_comparison_operator<int>::value));
BOOST_STATIC_ASSERT((!supports_comparison_operator