Boost logo

Boost :

Subject: Re: [boost] [Boost.Test] Assertion changes in trunk? [WAS: Call for Review: Boost.Test documentation rewrite]
From: pfultz2 (pfultz2_at_[hidden])
Date: 2014-01-23 09:35:48

> The precedence I was concerned about was not op== Thorsten, but unary op*.
> Apologies, my example is probably not what I meant. Here's another try:
> MACRO(lhs_ptr == rhs_ptr) expands to
> OTHER_MACRO(Catch::ExpressionDecomposer()->*lhs_ptr == rhs_ptr, ...)
> And since unary op* has higher precedence than op->*, I think that's
> equivalent to
> OTHER_MACRO(Catch::ExpressionDecomposer()->(*lhs_ptr) == rhs_ptr, ...)
> I.e. no longer Catch::ExpressionDecomposer::op->* and lhs, but
> Catch::ExpressionDecomposer::op->
> and (*lhs). Thus compile error? Not tried, obviously...
> Perhaps it doesn't matter if the only goal of ExpressionDecomposer is to
> know what operator is used by the expression, and it doesn't care about
> the
> type the template param of its op->* becomes, but in this case it looks to
> me that the 'star' will associate to lhs, not to ->. Again, I'm no C++
> expert. I'm just concerned over such trickery "just" to have a single
> macro, in Catch and more importantly here to Boost.Test. --DD

The `->*` operator is one complete operator. In C++, the operators are
during lexing before the preprocessor, and they don't change(with the
of the `>>` operator in C++11). Futhermore, precedence decides the order of
operators, not what the operators will become.


View this message in context:
Sent from the Boost - Dev mailing list archive at

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