boost-phoenix

Boost phoenix or lambda library problem: removing elements from a std::vector.

I recently ran into a problem that I thought boost::lambda or boost::phoenix could help be solve, but I was not able to get the syntax right and so I did it another way. What I wanted to do was remove all the elements in "strings" that were less than a certain length and not in another container. This is my first try: std::vector<std::...

boost lambda or phoenix problem: using std::for_each to operate on each element of a container

I ran into a problem while cleaning up some old code. This is the function: uint32_t ADT::get_connectivity_data( std::vector< std::vector<uint8_t> > &output ) { output.resize(chunks.size()); for(chunk_vec_t::iterator it = chunks.begin(); it < chunks.end(); ++it) { uint32_t success = (*it)->get_connectivity_data(output[it-chunks.beg...

What is the difference between Boost::bind and Boost Phoenix::bind?

What is the difference between Boost::bind and Boost Phoenix::bind? ...

Error on boost phoenix::bind compiling

I'm using phoenix::bind and receiving this error message: error C2039: 'bind' : is not a member of 'phoenix' The code line where I'm using bind and where the error is pointing is: phoenix::bind( &OptionalInputPort::eraseDataEditor ) ( phoenix::var( *optionalPort ) ) and I can't figure out what is the pro...

Compiliation errors on boost files

I'm getting a lot of errors compiling code using the boost libraries, mainly when I'm using Spirit namespace. The errors are syntax errors on boost files like: boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C2143: syntax error : missing ';' before '<' or boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C4430: miss...

Functional data structures in C++

Does anyone know of a C++ data structure library providing functional (a.k.a. immutable, or "persistent" in the FP sense) equivalents of the familiar STL structures? By "functional" I mean that the objects themselves are immutable, while modifications to those objects return new objects sharing the same internals as the parent object wh...

boost lambda versus phoenix

hello. I recently started looking at boost phoenix, as replacement for lambda. Is phoenix a full replacement for lambda, or is there some lambda functionality which is not provided by phoenix? is phoenix mature? Are there any gotcha I should know about? my primary interest are operator composition, control statements and casts are les...

C++ boost::lambda::ret equivalent in phoenix

hello. Boost lambda allows to overwrite deduced return type using ret<T> template. I have tried searching for equivalent in phoenix but could not find one. Is there an equivalent in phoenix? I know how to make my own Replacement but I would rather not. thank you ...

How to use a phoenix expression with boost::transform_iterator?

<Update> As usual for me, the question was a wrong one. The actual question is: why doesn't transform_iterator use the conventional result_of<> metafunction to determine the return type, instead of accessing UnaryFunc::result_type directly. Posted an answer with a work around. </Update> Specifically, is there a way to make a phoenix ...

Boost Spirit rule with custom attribute parsing

I am writing a Boost Spirit grammar to parse text into a vector of these structs: struct Pair { double a; double b; }; BOOST_FUSION_ADAPT_STRUCT( Pair, (double, a) (double, a) ) This grammar has a rule like this: qi::rule<Iterator, Pair()> pairSequence; However, the actual grammar of pairSequence is this: doub...

Parsing with Boost Spirit, getting extra items

This is long with a lot of code, so I hope Stack Overflow can cope with it. :P I'm trying to write an SVG parser with Boost Spirit. I have a grammar that populates a vector with "Contours," which are vectors of "BezierPoints," which may represent either regular points or points with bezier controls. So far I have this (not handling re...

Boost Phoenix: Binding to reference members of structures?

I would like to use Boost Phoenix to generate a lambda function for use in a std::find_if operation on a structure that contains reference-type members. A contrived example is as follows: struct MyStruct { MyStruct() : x(0) {} int& x; }; std::vector<MyStruct> AllStructs; // Search the array for an element for which x == 5...

Understanding and using the Boost Phoenix Library with a focus on lazy evaluation

I just found out about the Boost Phoenix library (hidden in the Spirit project) and as a fan of the functional-programming style (but still an amateur; some small experience with haskell and scheme) i wanted to play around with this library to learn about reasonable applications of this library. Besides the increasement of expressivenes...

How can I extract a std::string with boost.spirit?

Hi Using boost.spirit I try to parse simple command line of the form command:param1 param2... to do so I created this parser: (+(char_ - ':'))[ref(cmd) = _1] >> ':' >> (*char_)[ref(params) = _1] The attribute types of the two compounds parser is vector, so if cmd and params are of type vector this work. However if they are of type s...