Questions tagged [boost-phoenix]

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

159 questions
5
votes
1 answer

Using boost phoenix, how can I invoke a find_if call with starts_with?

I'm trying to find an element in a vector of structs. The code works when searching in a case-sensitive manner. When I try enhancing it to be case-insensitive, I run into two issues. Simply including boost/algorithm/string.hpp breaks the…
Graham Perks
  • 23,007
  • 8
  • 61
  • 83
5
votes
1 answer

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

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…
Mathieu Pagé
  • 10,764
  • 13
  • 48
  • 71
5
votes
1 answer

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

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…
academicRobot
  • 6,097
  • 1
  • 31
  • 29
5
votes
2 answers

how to create boost phoenix make_shared?

Is it possible to create boost phoenix lazy variant of std::make_shared? I mean, to make possible something like namespace p = boost::phoenix; ... expr = custom_parser[_a=p::make_shared(_1,_2,_3)] >> ... One cannot use…
polytheme
  • 51
  • 1
5
votes
2 answers

Can I stringify a Boost Phoenix expression?

Can I convert a Boost Phoenix expression into a representative string of C++? I could have: stringify(_1<_2); which might then produce a string containing something like: template struct foo { auto operator()(T1 x1, T2 x2) …
user2023370
  • 10,488
  • 6
  • 50
  • 83
5
votes
1 answer

Transforming Function Bodies within Boost Phoenix Expressions

How can I also include function bodies in a transformation of a Boost Phoenix expression? For example, I have built on the Lazy Functions section of the Boost Phoenix Starter Kit, and created a lazy addition function: struct my_lazy_add_impl { …
user2023370
  • 10,488
  • 6
  • 50
  • 83
5
votes
1 answer

Transforming a Boost C++ Phoenix Expression Tree

In the Boost Phoenix article, "Transforming the Expression Tree", here, a set of specialisations of a custom invert_actions class, are used to invert binary arithmetic expressions. For example a+b becomes a-b; a*b becomes a/b; and vice versa for…
user2023370
  • 10,488
  • 6
  • 50
  • 83
5
votes
1 answer

Why does this proto/phoenix toy example crash?

I am experimenting with proto and phoenix and what is one of my first toy examples crash and I have no idea where I should be looking at. Since someone on the #boost IRC channel told me to ensure that the phoenix expression tree is first deep copied…
Johannes Schaub - litb
  • 496,577
  • 130
  • 894
  • 1,212
4
votes
1 answer

is there a better way of converting to upper case in boost spirit?

I did something along the lines of creating a struct for phoenix::function struct to_upper_impl { template struct result { typedef std::string type; }; std::string operator()(const std::string & s) const { return…
eddi
  • 49,088
  • 6
  • 104
  • 155
4
votes
2 answers

How to access boost::variant members from Spirit::Qi rule?

I can't find a proper way how to access members of boost::variant using boost::phoenix in my Spirit-Qi grammar. Here is simple an example what I’m trying to achieve. (my whole grammar is much more complex, this is simple fragment where I'm testing…
rickba
  • 53
  • 4
4
votes
1 answer

boost::phoenix try_ catch_all construct fails to compile

I'm writing a boost::spirit::qi grammar for date parsing. #include #include #include template < typename InputIterator > struct date_rfc1123_grammar : …
zmij
  • 57
  • 7
4
votes
2 answers

Boost spirit changing variable value in semantic action

I want to change a local variable value in semantic action, like following: #define BOOST_SPIRIT_USE_PHOENIX_V3 #include #include #include namespace qi =…
haykart
  • 957
  • 5
  • 14
  • 34
4
votes
2 answers

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…
Raindog
  • 1,468
  • 3
  • 14
  • 28
4
votes
2 answers

Post callbacks to a task queue using boost::bind

Suppose I have a function called subscribe() that takes a callback handler, which will be called when the event is triggered. Now, I have another version, called subscribe2(). Everything is the same except that, when triggered, it needs to post it…
4
votes
2 answers

boost spirit qi on_error pass error_handler struct by reference

I have yet another blocker issue with Spirit Qi. I have implemented error handling in a functor struct called error_handler. This is passed to the grammar constructor by reference (see the MiniC example for Qi). I then have on_errors defined…
namezero
  • 2,203
  • 3
  • 24
  • 37
1
2
3
10 11