Boost logo

Boost :

From: Christian Mazakas (christian.mazakas_at_[hidden])
Date: 2024-02-26 16:04:34

> I would recommend putting something like the above in the docs, where the
> motivation for using rule parsers is listed. Currently it states "fix the
> attribute type produced by a parser to something other than the default"
> but what you sayin above is more: "prevent the parsers from doing things
> that they would otherwise do".

Ha, came online to say exactly this. I think that description of the
problem being
solved is more than satisfactory and illuminates the issue quite well.

> I note that parsing a homogenous sequence to a std::set does work, at
> without rules:
> I was surprised to find that, in the context of other precautions, feeding
> parsed data to a collection is performed via `insert` rather than
> `push_back`.
This is probably a holdover from the X3 days as this is who Spirit treats
generically and, ironically, is done for the exact reason that `std::set`
`insert(pos, val)`.

In principle, I don't think that a free-form grammar like the above parsing
into a `set`
is problematic. Instead, I agree more with Zach that when you're formally
defining rules,
you're really telling the library, "Hey, this is exactly what I want to be
parsing into."

- Christian

Boost list run by bdawes at, gregod at, cpdaniel at, john at