3

Taken from this answer here:

static const qi::rule<std::string::iterator, ast_t()> node = 
'{' >> *node >> '}' | +~qi::char_("{}");

Note that a constant var of name node is declared, but node is used to initialize this constant.

What's going on here?

Helpful "Similar Questions" shows that it is valid in C++ in general, but what does it do in this spirit expression?

Community
  • 1
  • 1
Martin Ba
  • 37,187
  • 33
  • 183
  • 337

1 Answers1

4

It's a recursive definition, very similar to this example with linked lists. A grammar rule is constructed which refers back to itself. It works because operator* takes its argument by (const) reference.

Community
  • 1
  • 1
Fred Foo
  • 355,277
  • 75
  • 744
  • 836