【发布时间】:2015-01-30 17:36:19
【问题描述】:
你能解释一下为什么会打印出1吗?不应该BOOST_TYPEOF 返回const int。如何在不使用 c++11 特性的情况下检查函数是否返回 const?
#include <iostream>
#include <boost/typeof/typeof.hpp>
#include <boost/type_traits/is_same.hpp>
const int f_const_int() {return 1;}
int main()
{
typedef BOOST_TYPEOF(f_const_int()) type;
std::cout << (boost::is_same<type, int>::value) << std::endl;
}
【问题讨论】:
标签: c++ boost constants typeof