lexical_cast bug.
Hello, I am a new suscriber to the list. I want to report what I consider a bug in lexical_cast conversion template. First, I wanted to use it to convert things to std::string (Target). It throws a bad_lexical_cast_exception when I pass an empty std::string object (one that is default-constructed or constructed with "") as the Source argument. It throws it because the condition (interpreter >> result ) evaluates to false. My solution was to specialize the function template this way: template<> lexical_caststd::string(const std::string &str) { return str; } but it is not so general to support const std::string or const std::string& as Target type or perhaps std::string or const std::string etc as Source. Correct me if I am wrong, so I learn from you more experienced Boost (and then C++) users. That's all for now. Thanks in advance. Eduardo Chao. [Non-text portions of this message have been removed]
participants (1)
-
Eduardo Chao