Why are bitwise shifts (<< and>>) used for cout and cin?

后端 未结 13 1580
眼角桃花
眼角桃花 2020-12-02 16:16

Question is in the title really; I\'m sure there is something logical, but for now I\'m stumped!

相关标签:
13条回答
  • 2020-12-02 17:15

    They are not bitwise operators, They are called insertion and extraction operators in this context.

    http://www.cplusplus.com/doc/tutorial/basic_io/

    These are used only for visual interpretation. If you study developing own stream and operator overloading, then you can see that you can even use + for input and - for output :)

    0 讨论(0)
提交回复
热议问题