Martin Ecker
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
::value)); BOOST_STATIC_ASSERT((supports_comparison_operator ::value));
This implementation is based on boost/detail/is_incrementable.hpp.
#include