Boost.Phoenix is a C++ library to enable function programming in C++.
Questions tagged [boost-phoenix]
159 questions
0
votes
0 answers
Access member of returned struct in boost lambda/phoenix
I want to replace some older code with simpler, functor based code. But I don't want to introduce a functor class for this and use boost::lambda/phoenix for this as I don't have C++11 at hand.
Old code looks like this
int player = ...;
Point…

Flamefire
- 5,313
- 3
- 35
- 70
0
votes
0 answers
Boost Spirit Karma repeat same output for every entry in a vector
Starting with a trivial problem, I chose to use boost::spirit::karma to turn it into something a little trickier. We have a map that maps entries of an enum class to vectors of ints, I'd like to produce output of the form
Foo has 3 entries:
Foo…

Xoph
- 459
- 2
- 10
0
votes
1 answer
Get Number of Iterations?
I was wondering if there is a way to count the number of iterations that happens for a specific grammar. Effectively counting how many parameters there would be for a function.
This is using the boost spirit library for parsing my own syntax, i am…

user3901459
- 824
- 3
- 11
- 18
0
votes
1 answer
Implementing division operator
I'm writing a simple calculator using boost spirit.
I want the division operator to throw an exception if a zero denominator is encountered.
I'm thinking along the lines of
term =
factor [qi::_val = qi::_1]
>> *(('*'…

P45 Imminent
- 8,319
- 4
- 35
- 78
0
votes
2 answers
boost::transform() only if value being added isn't NULL?
I have the following code:
// For each trigger model (_1) (which is just a CString), do:
// m_triggers.push_back(triggers.GetTrigger(static_cast(_1)))
boost::transform(
model.Triggers(),
std::back_inserter(m_triggers),
…

void.pointer
- 24,859
- 31
- 132
- 243
0
votes
1 answer
Variable hiding within nested let blocks in Boost Phoenix
I'm having some trouble with nested let blocks in Boost Phoenix when an "inner" local variable hides an "outer" local variable. Even with the "Visibility" example from the documentation here, shown here:
#include
#include…

user2023370
- 10,488
- 6
- 50
- 83
0
votes
1 answer
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 )
…

Leandro Lima
- 1,140
- 3
- 24
- 42
0
votes
3 answers
What is wrong with my Phoenix lambda expression?
I would expect the following example Boost Phoenix expression to compile.
What am I missing?
int plus(int a,int b)
{
return a+b;
}
void main(int argc,char** argc)
{
auto plus_1 = phx::bind(&plus,1,arg1);
auto value =…

Ted
- 14,465
- 6
- 28
- 28
0
votes
1 answer
ref() in Boost::Lambda?
What is the equivalent of Boost::Phoenix's ref in Boost::Lambda? I can't find it in the online docs.
#include
#include
#include
using namespace boost::lambda;
int main()
{
std::string a, b;
…

user541686
- 205,094
- 128
- 528
- 886