Are there any operators in D that are not in C++?
+3
A:
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 :)
LukeN
2010-04-22 16:43:37
Ok, Thanks Sadface.
Winter
2010-04-22 17:54:55
+5
A:
^^
and^^=
for exponentiation~
and~=
for concatenation>>>
and>>>=
for signed (or is it unsigned) bit shift
BCS
2010-04-22 16:59:18
+5
A:
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.
Maciej Hehl
2010-04-22 17:14:59
+3
A:
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
he_the_great
2010-04-22 19:03:13