Callable 概念和 std::is_function 类型特征有什么区别?
What is the difference between Callable concept and the std::is_function type traits?
C++17会有一个Callable
concept and I was wondering what was exactly the difference with the types for which std::is_function<T>::value
是true
。它们等价吗?一个是另一个的超集吗?
C++17 will have a Callable
concept
自 C++11 以来,它就存在于标准中。
Are they equivalent? Is one a superset of the other?
不,事实上,它们完全不相交。 Callable
仅适用于对象类型,包括从指向成员的指针到具有重载 operator()
的类型,再到隐式转换为函数指针到函数指针本身的类型。
is_function
仅适用于实际函数类型,根据定义,它们不是对象类型。
C++17会有一个Callable
concept and I was wondering what was exactly the difference with the types for which std::is_function<T>::value
是true
。它们等价吗?一个是另一个的超集吗?
C++17 will have a
Callable
concept
自 C++11 以来,它就存在于标准中。
Are they equivalent? Is one a superset of the other?
不,事实上,它们完全不相交。 Callable
仅适用于对象类型,包括从指向成员的指针到具有重载 operator()
的类型,再到隐式转换为函数指针到函数指针本身的类型。
is_function
仅适用于实际函数类型,根据定义,它们不是对象类型。