#include <boost/utility/result_of.hpp>
int main()
{
typedef double (*Func)(double d); // 函数指针定义
Func func = sqrt; // 函数指针赋值
boost::result_of<Func(double)>::type x = func(5.0); // 类型推导
std::cout<< "x: " << x << std::endl;
std::cout<< "name: " << typeid(x).name() << std::endl; // 打印出x的类型名称
}
boost中result_of简单使用
最新推荐文章于 2022-07-26 18:24:30 发布