From: Pavol Droba (droba_at_[hidden])
Date: 2004-01-12 01:43:19
On Sun, Jan 11, 2004 at 07:01:09PM -0700, Jeff Garland wrote:
> On Sun, 11 Jan 2004 21:22:06 +0100, Pavol Droba wrote
> > Hi,
> > Is there any reason, why there is no default constructor provided
> > for date classes in the date_time library?
> >I seems to me, that it
> > would be quite reasonable to provide it, while intializing the
> > object to not_a_date_time. Current implementatio seems to be
> > unreasonably restrictive.
> The reason is because I don't really like default constructors. Perhaps
> surprisingly this is only the second time I recall this coming up. Last time
> it seems that I was pretty much convinced, but it never happened.
In my application, I need the default constructor. I'm using a templated code,
and I'm using default-constuctible values as defaults, when no other value
can be computed. Because it is a generic code, I have no way to find out
what a value to use to initialize a particular type. (well, I can factor out
the initialization to some function and overload it for all the different types,
but it would simply do the same thing as the default constuctor, so I don't
consider this as a reasonable solution).
> Of course you can do it by changing one line of code:
> Change boost/date_time/gregorian/greg_date.hpp::68
> explicit date(special_values sv):
> explicit date(special_values sv = not_a_date_time):
This is exactly what I did, to solve my problem. I'm just wondering why it is not
> > The other issue is, if there is a plan to add unicode support to the
> > library.
> Can you be a bit more specific about what you want? The streaming code should
> already support unicode if the underlying stream supports it.
I had to_xxx_string and from_xxx_string functions in mind. I would like to have wstring
variants, so I don't have to convert the string from unicode and back each time I'm using them.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk