[lexical_cast] fails to convert between basic_strings with different traits
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. This is example where I use custom basic_string that is case insensitive: http://pastebin.com/jGF0yN2m Thanks.
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? 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
participants (2)
-
Alexander Nasonov
-
Paul Graphov