Boost logo

Boost Users :

From: Terje Slettebų (tslettebo_at_[hidden])
Date: 2003-03-27 00:14:31


>From: "Tom Matelich" <tmatelich_at_[hidden]>

> Compiler: gcc 3.2 and 3.2.2
>
> I believe this is actually a bug in gcc, but I'm going to post it hopes
that
> someone can help me. We have a handy little tool for generating enums
with
> associated string conversion and stream insertion/extraction functions.
> When we upgraded to boost 1.30.0, lexical_cast'ing one of these enums to
> std::string started behaving incorrectly, rather than the name, it is
giving
> me the integral value. It seems that the lexical_stream is being used.
> Unfortunately, my test case is working fine. The complete test case
> (including definition of ZAcquisition::PPG) is appended at the end. The
> code I am seeing failure with looks like:
>
> void foo(ZAcquisition::PPG::Type gt)
> {
> ...
> std::string str;
> str = boost::lexical_cast<std::string>(gt);
> std::cerr << "DEBUG, storing encode for PPG: " << str << ", aka " << gt
> << std::endl;
> ...
> }
>
> This outputs (for example):
> DEBUG, storing encode for PPG: 0, aka ONE
>
> I tried boost::lexical_cast<std::string, ZAcquisition::PPG::Type>(gt) as
> well.
>
> Anyone have any ideas? For now I'm going to back out to 1.29.0's
> lexical_cast.

> It happens on my Windows/Intel 7.0 box as well.

It's a little difficult when you don't have a failing test case. If you had
that, I could have looked into it. The above code works correctly on Intel
C++ 7.0 (Windows), here.

Regards,

Terje


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