|
Boost Users : |
Subject: Re: [Boost-users] still stuck on expectation points
From: philip tucker (phhht_at_[hidden])
Date: 2010-04-20 18:44:48
On 16 Apr 2010, at 6:52 PM, OvermindDL1 wrote:
> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
If I have understood your advice correctly,
you suggest that this code should compile:
> start %= (constitkind >> (id > (':' > (id >> probs)))) % ",";
It doesn't.
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