【发布时间】:2013-03-05 21:31:35
【问题描述】:
使用 g++ 4.7.2 版,如果我尝试编译以下内容
#include <boost/date_time/local_time/local_time.hpp>
class Bar
{
public:
Bar() { tz_db_.load_from_file("/home/date_time_zonespec.csv"); }
private:
boost::local_time::tz_database tz_db_;
};
int main()
{
return 0;
}
使用 -std=c++0x 我收到以下错误。
In file included from /usr/local/include/boost/date_time/local_time/local_time_types.hpp:18:0,
from /usr/local/include/boost/date_time/local_time/local_time.hpp:13,
from test.h:4,
from test.cpp:1: /usr/local/include/boost/date_time/local_time/custom_time_zone.hpp: In instantiation of ‘bool boost::local_time::custom_time_zone_base<CharT>::has_dst() const [with CharT = char]’: test.cpp:11:1: required from here /usr/local/include/boost/date_time/local_time/custom_time_zone.hpp:67:30: error: cannot convert ‘const boost::shared_ptr<boost::date_time::dst_day_calc_rule<boost::gregorian::date>
>’ to ‘bool’ in return
如果我不使用 c++0x 选项,一切都很好。 谁能告诉我这是怎么回事?
【问题讨论】: