2013/3/16 Antony Polukhin <antoshkka@gmail.com>
2013/3/16 Antony Polukhin <antoshkka@gmail.com>:
> 2013/3/15 Alain Leblanc <aalebl@gmail.com>:
>> Here's some code that has been compiling till at least 1.50, and starting
>> long before. I isolated the part that breaks to create a program.
>>
>> Here it is: Just taking a std::vector of int and copying into strings.
>>
>> #include <boost/lexical_cast.hpp>
>> #include <vector>
>> #include <string>
>>
>> using namespace std;
>>
>> int main (int, char **) {
>>   vector<int> values;
>>   vector<string> ret;
>>   std::transform(values.begin(), values.end(), ret.begin(),
>> boost::lexical_cast<std::string, int>);
>> }
>
> That is strange, I remember fixing that... I'll check everything once more.

You were right, I've accidentally removed the fix in one of the
commits (fixed it in trunk).
You may use solution poposed in previous letter, take lexical_cast
from boost trunk http://svn.boost.org/svn/boost/trunk/ or just replace
in boost/lexical_cast.hpp following code:

    template <typename Target, typename CharType>
    inline Target lexical_cast(const CharType* chars, std::size_t count)
    {
        BOOST_STATIC_ASSERT_MSG(boost::detail::is_char_or_wchar<CharType>::value,
            "CharType must be a character or wide character type");

        return boost::lexical_cast<Target>(
            boost::iterator_range<const CharType*>(chars, chars + count)
        );
    }


with


    template <typename Target>
    inline Target lexical_cast(const char* chars, std::size_t count)
     {
        return ::boost::lexical_cast<Target>(
            ::boost::iterator_range<const char*>(chars, chars + count)
        );
    }


    template <typename Target>
    inline Target lexical_cast(const unsigned char* chars, std::size_t count)
    {
         return ::boost::lexical_cast<Target>(
            ::boost::iterator_range<const unsigned char*>(chars, chars + count)
         );
     }

    template <typename Target>
    inline Target lexical_cast(const signed char* chars, std::size_t count)
    {
        return ::boost::lexical_cast<Target>(
            ::boost::iterator_range<const signed char*>(chars, chars + count)
        );
    }

#ifndef BOOST_LCAST_NO_WCHAR_T
    template <typename Target>
    inline Target lexical_cast(const wchar_t* chars, std::size_t count)
    {
        return ::boost::lexical_cast<Target>(
            ::boost::iterator_range<const wchar_t*>(chars, chars + count)
        );
    }
#endif
#ifndef BOOST_NO_CHAR16_T
    template <typename Target>
    inline Target lexical_cast(const char16_t* chars, std::size_t count)
    {
        return ::boost::lexical_cast<Target>(
            ::boost::iterator_range<const char16_t*>(chars, chars + count)
        );
    }
#endif
#ifndef BOOST_NO_CHAR32_T
    template <typename Target>
    inline Target lexical_cast(const char32_t* chars, std::size_t count)
    {
        return ::boost::lexical_cast<Target>(
            ::boost::iterator_range<const char32_t*>(chars, chars + count)
        );
    }
#endif

--
Best regards,
Antony Polukhin
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Thanks Greg and Antony. I modified my code following Antony's suggestion and it works fine.

a