ScaryAardvark
ScaryAardvark

Reputation: 2955

What is "operator<<" called?

I know the names of most of the operators but not sure what operator<< and operator>> are called.

i.e.

operator=() // the assignment operator
operator==() // the equality of comparison operator
operator++() // the increment operator
operator--() // decrement operator etc.
operator<() // the less-than operator

and so forth...

Upvotes: 26

Views: 39036

Answers (8)

Robben_Ford_Fan_boy
Robben_Ford_Fan_boy

Reputation: 8720

They are called the Guillemet Left and Guillemet Right symbols :)

Upvotes: 0

Jon Purdy
Jon Purdy

Reputation: 54981

The original names were left shift operator (<<) and right shift operator (>>), but with their meanings perverted by streams into insertion and extraction, you could argue that even in bitwise operations << inserts bits on the right while >> extracts them. Consequently, I almost always refer to them as the insertion and extraction operators.

Upvotes: 4

cpx
cpx

Reputation: 17557

In C++ Streams,

  • << is insertion operator.
  • >> is extraction operator.

In Binary Operations,

  • Right shift (>>)
  • Left shift (<<)

Upvotes: 21

Scott Stafford
Scott Stafford

Reputation: 44776

<< is both the insertion operator and the left-shift operator.
>> is the extraction operator and the right-shift operator.

In the context of iostreams, they are considered to be stream insertion/extraction. In the context of bit-shifting, they are left-shift and right-shift.

Upvotes: 43

Fraser
Fraser

Reputation: 17039

<< is the 'left-shift' operator. It shifts its first operand left by the number of bits specified by its second operand.

Upvotes: 1

davbryn
davbryn

Reputation: 7176

Bit Shift Operators

Upvotes: 4

GaryDevenay
GaryDevenay

Reputation: 2415

<< = Bitwise left shift
>> = Bitwise right shift

Upvotes: 8

Mitch Wheat
Mitch Wheat

Reputation: 300549

<< left shift

>> right shift

Upvotes: 18

Related Questions