Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2005-11-25 14:15:05


On Fri, 25 Nov 2005 10:50:50 +0800, A Johan wrote
> Hello All....
>
>
> Jeff,
>
> it might just be the way i'm using the boost classes that's causing
> all the problems. the posix_time is a member of a class which is a
> member of another class which is stored in a
> vector<boost::shared_ptr>. see below:
>
> class mydata {
> boost::posix_time::ptime m_timedata;
> /// other members...
> }
>
> class myobject {
> mydata m_data;
> /// other members...
> }
>...snip more code...

I don't think any of this should be a problem. BTW, the only place date-time
uses lexical_cast is in i/o code and to/from_string functions. So if you
aren't using that stuff it's probably coming from somewhere else.

> consequently althought the compiler is complaining a lot about the
> date_time lib it may come some other libs. i'm not sure. the programs
> run fine but i'm concerned i may miss some of the more crucial
> warnings as per project i get around 200++ warnings from the boost
> libs and i have about 6 projects in the vc solution.

Of course you could always supress the warnings.

> then again i might just be the vc71 compiler. all boost #includes
> need to be at the top of the file or else the compiler with give up with
> "Internal Compiler Error. Please call tech support...."

Well all I can say is vc71 is way better than vc6 on this -- but it's really
bad when it happens.

> just to make myself happy i tried doing a test program in a seperate
> project
>
> int main(void)
> {
> boost::posix_time::ptime
> mytime(boost::posix_time::second_clock::local_time);
> std::cout << mytime << std::endl;
>
> return 0;
> }
>
> this compiled clean without any warnings at all.
>
> all projects were compiled with warning level set to 4.

Right -- I doubt this code will ever invoke lexical cast. Try something like
this instead:

  ptime t;
  std::istringstream iss("2005-Jan-15 10:15:03.123456789123");
  iss >> t;

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