Boost logo

Boost Users :

Subject: [Boost-users] [lexical_cast] Some code that was compiling in 1.50 stopped compiling in 1.53
From: Alain Leblanc (aalebl_at_[hidden])
Date: 2013-03-15 15:44:17


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>);
}

And compiling on fedora 18, gcc 4.7 (Got same issues, I believe, with MSVC
10) I get the output at the bottom.
Anyone has an idea on what the problem could be?

Thanks,

a

[aleblanc_at_localhost base]$ gcc -c TestLexicalCast.cc
[aleblanc_at_localhost base]$ gcc -c
-I/home/aleblanc/local/boost_1_53/include/ TestLexicalCast.cc
TestLexicalCast.cc: In function ‘int main(int, char**)’:
TestLexicalCast.cc:10:98: error: no matching function for call to
‘transform(std::vector<int>::iterator, std::vector<int>::iterator,
std::vector<std::basic_string<char> >::iterator, <unresolved overloaded
function type>)’
TestLexicalCast.cc:10:98: note: candidates are:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/algorithm:63:0,
                 from
/home/aleblanc/local/boost_1_53/include/boost/utility/swap.hpp:24,
                 from
/home/aleblanc/local/boost_1_53/include/boost/swap.hpp:10,
                 from
/home/aleblanc/local/boost_1_53/include/boost/array.hpp:45,
                 from
/home/aleblanc/local/boost_1_53/include/boost/lexical_cast.hpp:158,
                 from TestLexicalCast.cc:1:
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:4940:5:
note: template<class _IIter, class _OIter, class _UnaryOperation> _OIter
std::transform(_IIter, _IIter, _OIter, _UnaryOperation)
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:4940:5:
note: template argument deduction/substitution failed:
TestLexicalCast.cc:10:98: note: could not resolve address from overloaded
function ‘lexical_cast<std::string, int>’
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/algorithm:63:0,
                 from
/home/aleblanc/local/boost_1_53/include/boost/utility/swap.hpp:24,
                 from
/home/aleblanc/local/boost_1_53/include/boost/swap.hpp:10,
                 from
/home/aleblanc/local/boost_1_53/include/boost/array.hpp:45,
                 from
/home/aleblanc/local/boost_1_53/include/boost/lexical_cast.hpp:158,
                 from TestLexicalCast.cc:1:
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:4977:5:
note: template<class _IIter1, class _IIter2, class _OIter, class
_BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter,
_BinaryOperation)
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:4977:5:
note: template argument deduction/substitution failed:
TestLexicalCast.cc:10:98: note: could not resolve address from overloaded
function ‘lexical_cast<std::string, int>’
[aleblanc_at_localhost base]$



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