23 Nov
2014
23 Nov
'14
11:12 a.m.
Phil Endecott
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?
In C++11, decltype and expression SFINAE make this trait very trivial. (decltype is enough to not need the signature.) Regards