Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-12-29 08:07:05

>From: "Terje Slettebø" <tslettebo_at_[hidden]>

> >From: "Early Ehlinger" <earlye_at_[hidden]>
> > std::stringstream temp;
> > temp << source;
> > return TargetType( temp.str().c_str() );
> >
> This exact solution would work as long as the other string-types
> the c_str() member function, like std::string.

Oops, I misread the code. This would work for any target type that has a
constructor which accepts a (const) char *. This is a good suggestion, and
it's kind of an extension to Gennadiy's proposal
tion1.cpp), which constructs the stringstream directly from a string, if the
_source_ is a string. Your proposal covers if the _target_ is a string. I
was going to add Gennadiy's proposal, and I'll add yours, as well. Thanks
for the suggestion.



Boost list run by bdawes at, gregod at, cpdaniel at, john at