Date-Time gregorian::date construction question

If a date object is constructed from an invalid date(e.g. Feb 29th,
2005) and the values are specified in the constructor, an exception is
thrown.
If the object is constructed from a string representation with
from_string(), no exception is thrown and the object has the next valid
date (in this case Mar 1st, 2005).
Is this a bug or a feature?
Best regards,
Wolfgang
#include <iostream>
#include

On Wed, 26 Jan 2005 17:20:40 +0100, Wolfgang Fertsak wrote
That would be a bug. Note that the only invalid dates that will do this are non-leap year Feb 29 dates. That is, strDate("2005-02-30") will throw the exception. I'm afraid I can't check in a fix just at the moment, but it's a one line fix if you want to patch it: Change line 146 of boost/date_time/date_parsing.hpp from < return date_type(ymd); to
return date_type(ymd.year, ymd.month, ymd.day);
With this change you'll get the exception for the feb 29th's as well. Thanks for the report. Jeff

On Thu, 27 Jan 2005 10:52:57 +0100, Wolfgang Fertsak wrote
Hmm, I tested it on gcc 3.2 before I wrote that. Are you sure you remembered to remove the first date construction from the program before you tested it? That is, if you left in: date Date1(2005,2,31); you never actually execute the code below it since the exception fires at that point. Well anyway, it's fixed now.... Jeff

sorry if this has been answered before, I'm new on the list. are there any resources explaining _efficient_ use of MPL? because I've written a few metafunctions which determine the virtual bases of a class and write them to a map, which you can use for not calling virtual bases twice. and it worked but with larger hierarchy structures I cancelled GCC after 5 minutes and 600 MB of memory. thanks,

"Stefan Strasser"
are there any resources explaining _efficient_ use of MPL?
See http://www.boost-consulting.com/metaprogramming-book.html, appendix C.
If you wrote everything correctly in terms of algorithm complexity, and it is still slow with GCC, see if you use metafunction forwarding, and try to remove it. It is a known problem that GCC is very slow with metafunction forwarding. HTH, Arkadiy
participants (5)
-
Arkadiy Vertleyb
-
Jeff Garland
-
Stefan Slapeta
-
Stefan Strasser
-
Wolfgang Fertsak