Boost logo

Boost :

Subject: Re: [boost] [type_traits] type_traits for types with operator().
From: Jonathan Wakely (jwakely.boost_at_[hidden])
Date: 2014-01-29 12:38:19

On 29 January 2014 17:28, John Maddock wrote:
> A better C++11 style interface *if* it can be implemented would be something
> like:
> template <class F, class Args...>
> struct is_callable;
> Which inherits from true_type only if F is callable with arguments Args...
> The tricky part is creating a decent interface that can deal with both
> lvalue and rvalue refs as arguments correctly.
> Actually I was sure there was something similar in the C++11 std, but I
> couldn't find anything.

It doesn't exist, but all std::lib implementations need something like
it, so it would be a good candidate for standardisation.

The traits in
provide even more functionality. is_callable<F(Args...)>::value would
be true iff raw_invocation_type<F(Args...)::type exists.

Boost list run by bdawes at, gregod at, cpdaniel at, john at