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

后端 未结 13 1719
眼角桃花
眼角桃花 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:01

    Bjarne chose them for practical precedence, associativity and mnemonic value.

    The precedence isn't perfect, e.g. the boolean and bit-level operators are troublesome.

    But it's fairly OK.

提交回复
热议问题