$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Janusz Piwowarski (jpiw_at_[hidden])
Date: 2004-04-17 04:25:44
Rob Stewart writes:
> That makes the result of the expression quite explicit. I can't
> see any problems with that approach. I'd expect an exception if
> the resulting month doesn't have the requested day. OTOH, if
> date's ctor were to take an extra argument, or if there was a
> date factory function supplying the different behavior, you could
> specify that you want clipping to the last day of the designated
> month:
>
> date(d.month() + 2 * months, d.day(), clip_to_eom)
> make_date_clipped_to_end_of_month(d.month() + 2 * months,
> d.day())
>
IMHO, simple date wrappers can give more readability:
d.allow_clipping_to_eom() + 2*months;
d.disallow_clipping_to_eom() + 2*months;
or
allow_clipping_to_eom(d) + 2*months;
disallow_clipping_to_eom(d) + 2*months;
where adding months to date directly isn't allowed.
Regards,
Janusz