- For
x == "-" || x == "~": Ifv ==, the function returnsWithNaN.defaultValue!T
WithNaN.defaultValue!T. Otherwise it returns the normal result of the operator. - For
x == "++" || x == "--": The function returnsvoid.
WithNaN.hookOpUnary
auto hookOpUnary(string x, T)(ref T v)Defines hooks for unary operators `-`, `~`, `++`, and `--`.
For `-` and `~`, if v == WithNaN.defaultValue!T, returns WithNaN.defaultValue!T. Otherwise, the semantics is the same as for the built-in operator.
For `++` and `--`, if v == WithNaN.defaultValue!Lhs or the operation would result in an overflow, sets v to WithNaN.defaultValue!T. Otherwise, the semantics is the same as for the built-in operator.
Parameters
x | The operator symbol |
v | The left-hand side of the comparison (T is the first argument to Checked) |