Boost logo

Boost Users :

Subject: Re: [Boost-users] [lexical_cast] fails to convert between basic_strings with different traits
From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2010-11-01 18:42:27


Paul Graphov wrote:
> Hello Boost Users,
>
> boost::lexical_cast fails to compile when both Target and Source template
> parameters are
> std::basic_string instantiations with different traits because
> deduce_char_traits
> class template has two suitable instantiations which are ambiguous.

<question mode>

Traits is passed to basic_stringstream. If they are different, which
should be picked?
Though, if both Source and Target are basic_strings, does the stream
object inside lexical_cast use Traits class at all?

</question mode>

Not sure it's feasible to support different traits in the current
implementation but it should be simple if we make string to string
conversion a special case and shorten it to:

    return Target(source.begin(), source.end());

Alex


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