compiler error with Phoenix and zip_iterator

The following piece of code works fine with MSVC 9.0 but fails with Gcc-4.4.2. Compiler throws lot of error messages due to the for_each call. I'm unable to figure out the exact problem ================== #include <vector> #include <string> #include <iostream> #include <sstream> using namespace std ; #include <boost/spirit/include/phoenix.hpp> namespace phx = boost::phoenix ; namespace pha = phx::arg_names ; #include <boost/iterator/zip_iterator.hpp> #include <boost/assign.hpp> using namespace boost::assign ; void updateOut (const boost::tuple<const string&, const int&>& p_tuple, vector<string>& p_out) { ostringstream os ; os << p_tuple.get<0>() << '-' << p_tuple.get<1>(); p_out += os.str() ; } int main (void) { vector<string> vs, out ; vector<int> vi, vi2 ; vs += "String", "String", "String", "String", "String"; vi += 1,2,3,4,5 ; vector<string>::const_iterator sbegIter = vs.begin(); vector<string>::const_iterator sendIter = vs.end(); vector<int>::const_iterator ibegIter = vi.begin(); vector<int>::const_iterator iendIter = vi.end(); std::for_each ( boost::make_zip_iterator(boost::make_tuple(sbegIter, ibegIter)), boost::make_zip_iterator(boost::make_tuple(sendIter, iendIter)), phx::bind (&updateOut, pha::arg1, phx::ref(out)) ) ; } ============ I'm using Boost-1.42.0 What is wrong with for_each call ? Thanks in advance, Surya

On 4/12/2010 7:03 PM, Surya Kiran Gullapalli wrote:
The following piece of code works fine with MSVC 9.0 but fails with Gcc-4.4.2. Compiler throws lot of error messages due to the for_each call. I'm unable to figure out the exact problem ==================
[snip]
I'm using Boost-1.42.0
What is wrong with for_each call ?
zip_iterator is not returning a real reference on dereference (*i). Unfortunately, this is not compatible with phoenix. Currently, phoenix takes its parameters by non const reference. Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon
participants (2)
-
Joel de Guzman
-
Surya Kiran Gullapalli