|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2005-06-03 22:51:47
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 ];
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk