1 Jul 03:10
Re: Attributes: ownership, construction, assignment, etc.
Carl Barron <cbarron413 <at> roadrunner.com>
2009-07-01 01:10:26 GMT
2009-07-01 01:10:26 GMT
On Jun 30, 2009, at 6:50 PM, John Freeman wrote:
> Howdy,
>
> I've encountered behavior I didn't expect when using attributes.
> During my efforts to track down the problem, I've been constructing
> some demonstrative examples. I hope they will clearly illustrate
> the differences between my desired behavior and the actual behavior.
>
> In my first example, imagine I am trying to build a payroll---a list
> of names tied to salaries. I chose the following type as my payroll
> data structure:
>
> typedef std::string name_t;
> typedef std::map< name_t, double > payroll_t;
>
>
> A simple grammar for my payroll might look like the following:
>
> name %= lexeme['"' >> *(ascii::print - '"') >> '"'];
>
> salary %= double_;
>
> start = '{'
> >> -(
> (name[_a = _1] >> ':' >> salary[_val[_a] = _1])
> % ','
> )
> >> '}';
(Continue reading)
RSS Feed