Thank you for the reply Dan.
Changing the iteration logic does indeed stop when expected, but for
me it raises a couple of question.
When using the month_iterator the != approach works so why not for the
week_iterator? As the month_iterator option I have uses the same
date_period approach.
The second question is since the iteration is over a predefined date
range whose start and ends are set why didn’t the iterations exhaust
on say Aug 2019? What allowed it to continue way outside of the
constrained range implying that the range is in fact much larger.
--
Bill
On Wed, 10 Jul 2019 at 17:48, Dan Bloomquist via Boost-users
Bill Moo via Boost-users wrote:
I can’t understand what, if indeed anything, I am doing wrong here.
The following is the code I am using to iterate the date_period:
for(boost::gregorian::week_iterator wi = dp.begin(); wi != dp.end(); ++wi) { items.push_back(formatParams(pi, (*wi))) ; }
Hi Bill, The problem is that you are looking for a match with 'wi != dp.end()'. You are not getting a match so you are blowing right though the end. Use:
wi < dp.end()
For your comparison and it will stop properly. Best, Dan.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users