Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
167 views
in Technique[技术] by (71.8m points)

c++ - 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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

<< 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...