Boost logo

Boost Users :

Subject: Re: [Boost-users] still stuck on expectation points
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-04-16 21:52:47


On Fri, Apr 16, 2010 at 7:47 PM, philip tucker <phhht_at_[hidden]> wrote:
>
> On 16 Apr 2010, at 6:16 PM, OvermindDL1 wrote:
>
>>
>>    start %= (constitkind >> (id > ':' > id) >> probs) % ",";
>>
>
> Thanks, but I already tried it.  Doesn't compile.

Er, if you re-read my post I was saying *not* to do that, because that
will not work, that is actually what the compiler is doing because of
operator precedence. You should memorize the precedence rules for
C++, *especially* if you are going to be dealing with heavily
templated operator libraries like Spirit.
  http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B

Because you are mixing right-shifts (>>) and greater-than's (>), the
precedence causes them to collapse in different ways, which is why you
need the parenthesis like this:
    start %= (constitkind >> (id > (':' > (id >> probs)))) % ",";

Again, learn the C++ operator precedence rules and all this will make
easy sense. :)


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