|
Boost Users : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2004-11-17 08:23:16
On Wed, 17 Nov 2004 21:43:45 +1100, Stuart Allie wrote
> Hi All,
>
> I've noticed a problem when trying to use ptime with, for example,
> STL containers and algorithms: the lack of a default constructor for
> ptime means a lot of the STL container methods just dont work.
>
> For example:
> std::vector<ptime> v;
>
> v.resize(10); // fails because there is no ptime::ptime() constructor!
>
> So, my questions are:
> 1. Is there an easy way to work around this?
>
> 2. What's the reason for the lack of a default c'tor? (Couldn't it
> just set the object to not_a_date_time?)
> 3. Am I missing something obvious and in fact the ptime class is
> perfectly compatible with the STL?
There is a default constructor in the 1.32 release (should be any minute now)
that constructs to not_a_date_time. You should be able to trivially patch
your current installation with this change if you don't want to upgrade.
Jeff
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net