It's a common question in the Spirit
General List: How do I parse and place the results into a C++ struct?
Of course, at this point, you already know various ways to do it, using
semantic actions. There are many ways to skin a cat. Spirit2, being fully
attributed, makes it even easier. The next example demonstrates some features
of Spirit2 that make this easy. In the process, you'll learn about:

Then, we need to tell Boost.Fusion
about our employee struct to make it a first-class fusion citizen that
the grammar can utilize. If you don't know fusion yet, it is a Boost
library for working with heterogeneous collections of data, commonly referred
to as tuples. Spirit uses fusion extensively as part of its infrastructure.

In fusion's view, a struct is just a form of a tuple. You can adapt any
struct to be a fully conforming fusion tuple:

is similar to Kleene star. Rather than match everything, +a matches
one or more. Like it's related function, the Kleene star, its attribute
is a std::vector<A>
where A is the attribute
of a. So, putting all these
together, the attribute of

Some parsers, especially those very little literal parsers you see, like
'"', do not have attributes.

Nodes without attributes are disregarded. In a sequence, like above, all
nodes with no attributes are filtered out of the fusion::vector.
So, since '"' has no attribute,
and +(char_-'"') has a std::vector<char> attribute, the whole expression's attribute
should have been:

fusion::vector<std::vector<char>>

But wait, there's one more collapsing rule: If the attribute is followed
by a single element fusion::vector,
The element is stripped naked from its container. To make a long story
short, the attribute of the expression:

In case you are wondering, lit("employee") is the same as "employee".
We had to wrap it inside lit
because immediately after it is >>'{'. You can't right-shift a char[]
and a char - you know, C++
syntax rules.

Now everything is clear, right? The structemployeeIS
compatible with fusion::vector<int,std::string,std::string,double>. So, the RHS of start
uses start's attribute (a structemployee) in-situ when it does
its work.