Boost logo

Boost Users :

Subject: Re: [Boost-users] [lexical_cast] Some code that was compiling in 1.50 stopped compiling in 1.53
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2013-03-16 04:57:01


2013/3/15 Alain Leblanc <aalebl_at_[hidden]>:
> 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.
Until then, you may try this workaround:

 int main (int, char **) {
   vector<int> values;
   vector<string> ret;

   typedef std::string(*f2)(const int&);
   f2 p2 = &boost::lexical_cast<std::string, int>;

   std::transform(values.begin(), values.end(), ret.begin(), p2);
 }

--
Best regards,
Antony Polukhin

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