Open viboes opened 8 years ago
I could add is_callable_with<C, Args...>
, which would be an alias for has_type<lazy::invoke<C, Args...>>
. Why you think that a test for is_convertible
is appropriate for metaprograms?
BTW, in order to avoid confusion between std Callables and meta Callables what do you think to rename Callable to Meta-Callable?
Well, once we have concepts in the language, the concept is called Meta-Callable -- or rather, meta::Callable
. I suppose when describing things in English I could use Meta-Callable as a disambiguator.
Originally I called it also is_callable_with
, but I changed it to follow std::is_callable
style. I added also the is_convertible
check in order to be as close as possible to std::is_callable
. I believe it doesn't hurt.
Please, take a look at https://github.com/boostorg/hana/issues/277.
Paul has showed me that it is not the same is_callable<F(int[3])>
than is_callable<F, int[3]>
. The first is deduced as is_callable<F(int*)>
:(
That's why I suggested is_callable_with<C, Args...>
. And I think checking for is_convertible
is actively hostile to metaprograms. At compile time, one type is not really "convertible" to another.
Hi,
I need a type traits to check if a Callable
Fn
can be invoked with some specific parametersArgs...
and if the result is convertible to a typeR
. Something in line withstd::is_callable
but usingmeta::invoke
instead ofstd::invoke
.As
meta::is_callable
is already used what would be the name of this new type trait?I would prefer to rename the current
meta::is_callable
to something else ut I don't have a good proposal. I use in my own codeis_type_constructor
as Meta-Callables are are functions that construct types.If
TC::template invoke<Xs...>
is well formed then ifR
isvoid
thentrue_type
elsestd::is_convertible<meta::invoke_t<Xs...>, R>
elsefalse_type
.No conversion check is performed when
R
isvoid
.BTW, in order to avoid confusion between std Callables and meta Callables what do you think to rename Callable to Meta-Callable?