Boost logo

Boost Users :

From: Bill Moo (mookimoo73_at_[hidden])
Date: 2019-07-11 08:15:49

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.

On Wed, 10 Jul 2019 at 17:48, Dan Bloomquist via Boost-users
<boost-users_at_[hidden]> wrote:
> 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_at_[hidden]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at