Questions tagged [boost-phoenix]

Boost.Phoenix is a C++ library to enable function programming in C++.

159 questions
23
votes
2 answers

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…
drg
  • 1,651
  • 1
  • 13
  • 9
21
votes
5 answers

What are the benefits of using Boost.Phoenix?

I can not understand what the real benefits of using Boost.Phoenix. When I use it with Boost.Spirit grammars, it's really useful: double_[ boost::phoenix::push_back( boost::phoenix::ref( v ), _1 ) ] When I use it for lambda functions, it's also…
Denis Shevchenko
  • 1,342
  • 2
  • 10
  • 23
16
votes
2 answers

When is boost phoenix useful?

Possible Duplicate: What are the benefits of using Boost.Phoenix? So I started reading the documentation for boost phoenix. However, I must admit that I don't quite understand the purpose of the library, especially since we have language support…
ronag
  • 49,529
  • 25
  • 126
  • 221
14
votes
3 answers

Does bind() have any advantage (other than compatibility) over C++11 lambdas?

I'm thinking about migrating my code toward using C++11-style lambdas instead of having binds everywhere. But I'm not sure if it's a good idea or not. Does using e.g. boost::lambda (or boost::phoenix) have any practical advantage over C++11-style…
user541686
  • 205,094
  • 128
  • 528
  • 886
13
votes
1 answer

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

What is the difference between Boost::bind and Boost Phoenix::bind?
Leandro Lima
  • 1,140
  • 3
  • 24
  • 42
12
votes
2 answers

Difference between boost::bind, boost::lambda::bind and boost::phoenix::bind

I am trying to understand the difference between these different bind approaches. There is a similar question at boost::bind and boost::phoenix::bind But, if anyone can explain this with examples it would be great. Also is it true that…
polapts
  • 5,493
  • 10
  • 37
  • 49
10
votes
1 answer

Boost::Spirit Expression Parser

I have another problem with my boost::spirit parser. template struct expression: qi::grammar { expression() : expression::base_type(expr) { number %=…
Lanbo
  • 15,118
  • 16
  • 70
  • 147
10
votes
1 answer

boost lambda versus phoenix

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…
Anycorn
  • 50,217
  • 42
  • 167
  • 261
9
votes
3 answers

Boost::Spirit::Qi. How to turn inlined parser expressions into standalone grammars, and how to unpack the tuples generated by them?

I'm using QI and Phoenix, and I want to write a small grammar that returns 4 bools which are to be used as arguments for a function call inside a semantic action. I have several functions that need those things, and so far I have used this…
Erius
  • 1,021
  • 8
  • 21
8
votes
1 answer

Boost.Spirit.Qi: Take a rule's attribute and set it as a field of an enclosing rule's struct attribute?

Like, many of these other questions, I'm trying to parse a simple grammar into a tree of structs using Boost.Spirit.Qi. I'll try to distill what I'm trying to do to the simplest possible case. I have: struct Integer { int…
jtolds
  • 3,341
  • 3
  • 17
  • 14
8
votes
1 answer

Static functions from boost.lambda or boost.phoenix

I regularly use boost.lambda (and phoenix) to define lambda functions in C++. I really like their polymorphic property, the simplicity of their representation and the way they make functional programming in C++ so much easier. In some cases, it's…
enobayram
  • 4,650
  • 23
  • 36
7
votes
1 answer

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…
sascha
  • 32,238
  • 6
  • 68
  • 110
7
votes
1 answer

How do I convert boost::spirit::qi::lexeme's attribute to std::string?

Consider: struct s { AttrType f(const std::string &); }; ...and a rule r with an attribute AttrType: template using rule_t = boost::spirit::qi::rule
Braden
  • 1,448
  • 10
  • 11
6
votes
1 answer

How can I make std::find_if and std::map work together using some boost library?

This question is inspired from another topic which poses this question: Find the first value greater than user specified value from a map container which can be solved in several ways. A typical C++03 solution defines a dedicated function (or…
Nawaz
  • 353,942
  • 115
  • 666
  • 851
6
votes
2 answers

Is Boost.Phoenix inherently slower than the equivalent C++11 lambdas (does it use virtual calls, 'volatile' usage, etc.)?

I always thought Boost.Phoenix used type-inference to infer everything statically, until I tried this code: #include #include using namespace boost::phoenix; using namespace boost::phoenix::placeholders; struct…
user541686
  • 205,094
  • 128
  • 528
  • 886
1
2 3
10 11