我正在使用boost::asio::steady_timer _timer
,但我发现如果使用 -std=c++11 标志,编译器将在以下位置报告无法转换类型的错误:
boost::asio::steady_timer::time_point now() {
return boost::asio::steady_timer::clock_type::now();
}
并且在以下位置没有 operator+() 的匹配函数:
_timer.expires_at(now()+boost::chrono::milliseconds(100));
似乎编译器无法在 c++11 模式下推断出正确的类型。但相反我使用
boost::asio::basic_waitable_timer<boost::chrono::steady_clock> _timer;
并更改boost::asio::steady_timer::time_point
为
boost::chrono::steady_clock::time_point
没关系。但是,它们是相同的,并且在没有 0x 或 11 模式的 g++ 中可以正常工作。
C++11 对 typedef 推断有什么不同吗?还是boost配置问题?