Le 02/03/2016 03:57, Steven Watanabe a écrit :
AMDG
On 02/28/2016 06:15 AM, Vicente J. Botet Escriba wrote:
Le 27/02/2016 17:41, Steven Watanabe a écrit :
constexpr infix_adaptor
plus = {}; int r = 3 <plus> 2; This is clever idea, but I'd really like to see an analysis of how it interacts with operator precedence.
You should consider the normal precedence for operator<() and operator>() and use parenthesis when you are not sure what will be the result ;-) There is no magic.
<snip>
P.S. Paul, maybe you can add something about this in the documentation of infix.
That's all I was getting at. Sure, I can work out what happens, but I'd be happier if the documentation showed some indication that the author had considered the issue, and found (a) there's nothing to worry about, it will always work correctly, or (b) it can only cause problems in some obscure circumstances. Also, if the user makes a mistake, how confused can the compiler get?
I'd also like some explanation of how it interacts with other kinds of trickiness:
- phoenix::_1 <plus> phoenix::_2 - BOOST_TEST(1 <plus> 2);
Paul, do you have something to add? Vicente