Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如我有一个日期对象:
boost::gregorian::date date1(2013,1,31);
现在我想将日期更改为 1。如何将日期设置为 1?
日期类型是不可变的,除了赋值,所以你需要创建一个新的日期:
date1 = boost::gregorian::date(date1.year(), date1.month(), 1);