
"Eric Niebler" <eric@boost-consulting.com> writes:
Howard Hinnant wrote:
The scary part is that we do so many useful things these days by tentatively passing non-POD's past an ellipses, though only at compile time, never at run time. But the compiler is not making that distinction. This is a big problem, and I suspect it will need to be addressed at the standards level. I don't have a solution yet.
The solution is to not pass non-PODs through ellipses, of course. ;-)
double is_mem_fun_ptr_tester(...);
template<typename Class, typename Ret> char is_mem_fun_ptr_tester(Ret (Class::**)());
template<typename T> struct is_member_function_pointer { BOOST_STATIC_CONSTANT(bool, value = 1==sizeof(is_mem_fun_ptr_tester(static_cast<T*>(0)))); };
typedef char test1[ is_member_function_pointer<void (dummy::*)()>::value ]; typedef char test2[ !is_member_function_pointer<dummy>::value ];
You have to take some steps to eliminate the formation of pointers-to-references, i.e. a partial specialization on compilers that support it and some wretched mess everywhere else. -- Dave Abrahams Boost Consulting www.boost-consulting.com