Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Callable concept and the std::is_function type traits?

C++17 will have a Callable concept and I was wondering what was exactly the difference with the types for which std::is_function<T>::value is true. Are they equivalent? Is one a superset of the other?

like image 436
Vincent Avatar asked Dec 02 '15 02:12

Vincent


1 Answers

C++17 will have a Callable concept

It's there in the standard since C++11.

Are they equivalent? Is one a superset of the other?

No, in fact, they are completely disjoint. Callable applies only to object types, and include everything from pointer-to-members to types with an overloaded operator() to types with an implicit conversion to function pointers to function pointers themselves.

is_function is true only for actual function types, which are, by definition, not object types.

like image 186
T.C. Avatar answered Sep 22 '22 07:09

T.C.