Hello all, first of all, apologies for cross posting. I've a question in phoenix and I do not know where will it fit in. the piece of code is located at http://pastebin.com/f16f5c6a2 What is wrong with line #9 . Thanks, Surya
On Thu, Nov 26, 2009 at 7:46 AM, Surya Kiran Gullapalli < suryakiran.gullapalli@gmail.com> wrote:
Hello all, first of all, apologies for cross posting. I've a question in phoenix and I do not know where will it fit in.
the piece of code is located at
What is wrong with line #9 .
Can you provide the full code, including the #includes, and say which version of Boost you're using, and which compiler. - Rob.
Can you provide the full code, including the #includes, and say which
version of Boost you're using, and which compiler.
- Rob.
Hello the complete code is given below. I'm using Boost 1.41.0 on VC9 and VC8. ============================================================================= #include <iostream> #include <vector> #include <string> #include <algorithm> using std::cout ; using std::endl ; #include <boost/algorithm/string/trim.hpp> #include <boost/spirit/include/phoenix.hpp> namespace phx = boost::phoenix ; namespace pha = phx::arg_names ; namespace str_algo = boost::algorithm ; void trim(std::string& s) { str_algo::trim(s) ; } int main (void) { std::vector<std::string> vs ; vs.push_back (" String1 ") ; vs.push_back (" String2 ") ; vs.push_back (" String3 ") ; phx::for_each (pha::arg1, phx::lambda[ cout << pha::arg1 << '\n' ])(vs) ; cout << "===================================" << endl ; // What I'm trying to do is call boost::algorithm::trim on all elements of vector. // the below given statement works without any problem. std::for_each (vs.begin(), vs.end(), phx::bind(&trim, pha::arg1)); //How do I call boost::algorithm::trim directly using Boost.Phoenix or Boost.Lambda. Below //I'm trying to do it using phoenix. //std::for_each (vs.begin(), vs.end(), phx::bind(&str_algo::template trim, pha::_1)); phx::for_each (pha::arg1, phx::lambda[ cout << pha::arg1 << '\n' ])(vs) ; cout << "===================================" << endl ; } ===============================================================================
Surya Kiran Gullapalli wrote:
Hello all, first of all, apologies for cross posting. I've a question in phoenix and I do not know where will it fit in.
the piece of code is located at
What is wrong with line #9 .
You can't call it like that. Use bind or make a phoenix function. 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 (3)
-
Joel de Guzman
-
Robert Jones
-
Surya Kiran Gullapalli