View source code
Display the source code in std/checkedint.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.checkedint.Checked.opBinary
Defines binary operators +
, -
, *
, /
, %
, ^^
, &
, |
, ^
, <<
, >>
,
and >>>
. If Hook
defines hookOpBinary
, opBinary
forwards to Checked!(typeof(hook
.
auto opBinary(string op, Rhs)
(
const Rhs rhs
)
if (isIntegral!Rhs || isFloatingPoint!Rhs || is(Rhs == bool));
auto opBinary(string op, Rhs)
(
const Rhs rhs
) const
if (isIntegral!Rhs || isFloatingPoint!Rhs || is(Rhs == bool));
auto opBinary(string op, U, Hook1)
(
Checked!(U,Hook1) rhs
);
auto opBinary(string op, U, Hook1)
(
Checked!(U,Hook1) rhs
) const;
If Hook
does not define hookOpBinary
but defines onOverflow
,
opBinary
forwards to hook
in case an
overflow occurs.
If two Checked
instances are involved in a binary operation and both
define hookOpBinary
, the left-hand side hook has priority. If both define
onOverflow
, a compile-time error occurs.
Parameters
Name | Description |
---|---|
op | The binary operator |
rhs | The right hand side operand |
U | If rhs is a Checked instance, U represents
the underlying instance type |
Hook1 | If rhs is a Checked instance, Hook1 represents
the instance's behavior hook |
Returns
A Checked
instance representing the result of the binary
operation
Authors
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.