What makes Scala's operator overloading “good”, but C++'s “bad”?

后端 未结 14 2101
悲哀的现实
悲哀的现实 2020-12-12 11:20

Operator overloading in C++ is considered by many to be A Bad Thing(tm), and a mistake not to be repeated in newer languages. Certainly, it was one feature specifically drop

14条回答
  •  半阙折子戏
    2020-12-12 12:04

    The only thing known wrong in C++ is the lack of the ability to overload []= as a separate operator. This could be hard to implement in a C++ compiler for what is probably not an obvious reason but plenty worth it.

提交回复
热议问题