Yes, it's in Boost.TTI: http://tinyurl.com/k3y5x8l
Has anyone ever worked out how to do this without having to specify the type? E.g. with BOOST_TTI_HAS_MEMBER_DATA I need to write something like
has_member_data_fieldname
::value; The most recent time I needed something like this, I wanted to test whether a struct contained a field with a particular name that was convertible to a float (I think float or int16_t in that case). I would have been happy with a test for a field with that name of any type. But I couldn't work out how to do it. Any ideas?
I just realized that BOOST_TTI_HAS_MEMBER_FUNCTION is not exactly same as mine.BOOST_TTI_HAS_MEMBER_FUNCTION will check the type signature and only return true if it's exactly match.
I would like to test if a member function of class is 'applicable'.
For example, below code will print 0, but I expect to get 1.BOOST_TTI_HAS_MEMBER_FUNCTION(foo)
class a{public: int foo(int);};
int main(){ std::cout << has_member_function_foo