octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51605] allow class overload of unary operator


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #51605] allow class overload of unary operators ++ and -- via function
Date: Mon, 14 Aug 2017 12:40:55 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Update of bug #51605 (project octave):

                 Summary: operands ++ and -- via function => allow class
overload of unary operators ++ and -- via function

    _______________________________________________________

Follow-up Comment #7:

Ernst - I've looked at this a little bit, and the problem may lie in the way
the operators are defined in the parser. When the parser encounters an
assignment operator like +=, then it is explicitly doing an assignment
expression with a left operand and a right operand. But when the parser
encounters a ++ or -- unary operator, it does not expand this into a full
assignment expression. It is instead treated as a
modify-in-place-unary-operator expression, and the increment or decrement
operator is called on the single object. The object is expected to be
responsible for modifying itself in place when the "decr" or "incr" operator
is called on it.

You are welcome to try to implement these operator overloads if you want, and
see how it will work and what the consequences will be.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51605>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]