Check if a type has a member function (inhrited member functions also) with Boost TTI
Boost TTI has very convenient macros for checking if a type has a member function. See http://www.boost.org/doc/libs/1_55_0/libs/tti/doc/html/the_type_traits_intro... If I have not missing something BOOST_TTI_HAS_MEMBER_FUNCTION returns false for inherited member functions. Is there a convenient Boost solution for doing this? There is a SOhttp://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-mem... solution based on SFINAE. But I would like to avoid that and would prefer a Boost solution, since that way I am more sure it works on more compilers and I want avoid maintaining code for each such specific behavior.
On 5/5/2014 1:20 PM, Hijok Payne wrote:
Boost TTI has very convenient macros for checking if a type has a member function. See http://www.boost.org/doc/libs/1_55_0/libs/tti/doc/html/the_type_traits_intro...
If I have not missing something BOOST_TTI_HAS_MEMBER_FUNCTION returns false for inherited member functions.
My testing shows that TTI returns false for inherited member functions which are protected, but works if they are public. I am working on a solution for inherited protected member functions.
Is there a convenient Boost solution for doing this? There is a SO http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-mem... solution based on SFINAE. But I would like to avoid that and would prefer a Boost solution, since that way I am more sure it works on more compilers and I want avoid maintaining code for each such specific behavior.
Thanks for the link. Hopefully this will help me.
On 5/8/2014 1:09 PM, Edward Diener wrote:
On 5/5/2014 1:20 PM, Hijok Payne wrote:
Boost TTI has very convenient macros for checking if a type has a member function. See http://www.boost.org/doc/libs/1_55_0/libs/tti/doc/html/the_type_traits_intro...
If I have not missing something BOOST_TTI_HAS_MEMBER_FUNCTION returns false for inherited member functions.
My testing shows that TTI returns false for inherited member functions which are protected, but works if they are public.
Apologies but I am wrong. TTI cannot identify inherited member functions even if they are public.
I am working on a solution for inherited protected member functions.
Is there a convenient Boost solution for doing this? There is a SO http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-mem... solution based on SFINAE. But I would like to avoid that and would prefer a Boost solution, since that way I am more sure it works on more compilers and I want avoid maintaining code for each such specific behavior.
Thanks for the link. Hopefully this will help me.
participants (2)
-
Edward Diener
-
Hijok Payne