|
Boost Users : |
Subject: [Boost-users] compiler error with Phoenix and zip_iterator
From: Surya Kiran Gullapalli (suryakiran.gullapalli_at_[hidden])
Date: 2010-04-12 07:03:52
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
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