Reputation: 1490
Are there any operators in D that are not in C++?
Upvotes: 14
Views: 692
Reputation: 7995
Here is a list of some D tokens
/=
.
..
...
&
&=
&&
|
|=
||
-
-=
--
+
+=
++
<
<=
<<
<<=
<>
<>=
>
>=
>>=
>>>=
>>
>>>
!
!=
!<>
!<>=
!<
!<=
!>
!>=
(
)
[
]
{
}
?
,
;
:
$
=
==
*
*=
%
%=
^
^=
~
~=
Those for example:
<>
<>=
!<>
!<>=
!<
!<=
!>
!>=
are special operators to compare floating point variables. You can find the description of them here http://www.digitalmars.com/d/1.0/expression.html
There are also the
is
!is
in
!in
typeof
operators.
Upvotes: 6
Reputation: 78683
^^
and ^^=
for exponentiation~
and ~=
for concatenation>>>
and >>>=
for signed (or is it unsigned) bit shiftUpvotes: 5
Reputation: 6784
Similar to Sadface's opApply there is also opCall for overloading when () is used, useful in structs. In fact on the Operator Overloading page there is a number of these:
opIndex
opIndexAssign
opSlice
opSliceAssign
opDispatch -- Rather interesting addition in D2
Upvotes: 3
Reputation: 5722
I didn't program D in a long time, but I think it has opApply
for use in foreach
- I don't know if you count it as an operator, but it sure is documented as such :)
Upvotes: 3