Boost logo

Boost Users :

Subject: Re: [Boost-users] Defining Statements with Proto
From: David A. Greene (greened_at_[hidden])
Date: 2010-01-03 13:15:59


On Saturday 02 January 2010 16:17:03 Eric Niebler wrote:

> The attached code compiles. You weren't handling the if_ case correctly.
> You had specialized ConstructGrammarCases on IfTag, but you weren't
> using IfTag anywhere, so that specialization wasn't getting picked up.
> There were a few other small problems, but on the whole, you were pretty
> close.

If I wanted to keep the IfRule case as a specialization, what should it be
specialized on? IfTag was a leftover remnant, so that was a coding error.
What I intended to do is this:

template<>
struct ConstructGrammarCases::case_<keyword::if_>
  : boost::proto::when<
  IfRule,
  ConstructBinary<If>(ConstructGrammar(boost::proto::_right(boost::proto::_left)),
                      ConstructGrammar(boost::proto::_right))> {};

But this leads to the compiler error seen earlier. Something like if_ is
going to have to use a case_ specialization, so it's necessary to know
how this is supposed to work.

                                        -Dave


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net