Winter
Winter

Reputation: 1490

D operators that are not in C++

Are there any operators in D that are not in C++?

Upvotes: 14

Views: 692

Answers (4)

Maciej Hehl
Maciej Hehl

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

BCS
BCS

Reputation: 78683

  • ^^ and ^^= for exponentiation
  • ~ and ~= for concatenation
  • >>> and >>>= for signed (or is it unsigned) bit shift

Upvotes: 5

he_the_great
he_the_great

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

chmod222
chmod222

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

Related Questions