Opened 8 years ago
Last modified 5 years ago
#11067 assigned Feature Requests
boost::gregorian::date_iterator missing postfix operators ++ and --
Reported by: | Owned by: | James E. King, III | |
---|---|---|---|
Milestone: | To Be Determined | Component: | date_time |
Version: | Boost 1.57.0 | Severity: | Problem |
Keywords: | boost::gregorian::date, boost::gregorian::date_iterator | Cc: |
Description
/* Consider the following (somewhat canonical) code snippet */ {
std::vector<boost::gregorian::date> dates(count); auto dt_i = dates.begin(); boost::gregorian::month_iterator m_i(some_start_date, 1);
while (dt_i != dts.end())
*dt_i++ = *m_i++; /* this will call prefix ++ operator on m_i
leading to subtle bug */
}
Change History (2)
comment:1 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 5 years ago
postfix operator implementation requires return-by-value, and in this case the get_offset and get_neg_offset methods are pure virtual, making that impossible in the current implementation.
Note:
See TracTickets
for help on using tickets.
Test (unsure if return is correct; will move into unit test before submitting PR):
When building with gcc-7.2 and -Wall: