Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-11-01 09:42:39

On 10/30/2005 09:27 PM, Larry Evans wrote:
> On 10/23/2005 01:08 PM, Larry Evans wrote:
> There's now a containing code and it's output for

I should have said where. It's in
in "Template Metaprogramming" directory.

I also should have said it uses a modifcation of the
range/iterator_range.hpp that's here:

> two inputs:
> ident
> ident * ident
> The code avoids any dynamic dispatching by using the "Curiously
> Recurring Template Pattern" (See Abrahams and Gurtovoy's _C++ Template
i.e. CRTP
> Metaprogramming_, section 9.8) in Grammar template.

It uses the mpl::map where keys are non-terminals and values are rhs for
those non-terminals. It then uses mpl::fold to create a grammar
class with a parser_production superclass for each non-terminal.
The only place the CRTP is actually useful is where the a non-terminal
is encountered on the rhs of the production. This is in:

   < vocabulary<nonterminal>::variable<WordId>
   , Grammar

Any comments or suggestions welcome.

Since spirit also uses CRTP, I'm guessing it uses
it for another purpose, i.e. a purpose other than
eliminating the need for virtual functions.

Anyone got a simple answer?

Since this topic seems more relevant to spirit, I'm
posting there also.


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