I want to write a C++ metafunction is_callable
that defines value
to be true
, if and only if the type F has the function cal
Something like this maybe? It's a bit round about to make it work on VS2010.
template
struct function_traits_impl;
template
struct function_traits_impl
{
typedef A1 arg1_type;
};
template
struct function_traits_impl
{
typedef A1 arg1_type;
};
template
struct function_traits_impl
{
typedef A1 arg1_type;
};
template
typename function_traits_impl::arg1_type arg1_type_helper(T);
template
struct function_traits
{
typedef decltype(arg1_type_helper(&F::operator())) arg1_type;
};
template
struct is_callable : public std::is_same::arg1_type, const Arg&>
{
}