With a bit of fiddeling you can use every kind of bracket to basically make function calls in c++

Here are the links to the snippets, all compile and run

Rust: https://godbolt.org/z/bM3d7bG14

OCaml: https://godbolt.org/z/17oMv83zx

C++: https://godbolt.org/z/9Y3WfoE1W

you are viewing a single comment's thread
view the rest of the comments
[–] 6 points 1 week ago (1 child)

As a computational physicist, I appreciate operator overloading IF used properly.
Example of a good use: + for matrix addition
Example of a bad use: left shift operator << as a pipe
I still don't understand who's in the C++ committee that they would choose this garbage over a function

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 6 days ago*

    My theory is that they came up with the concept of operator overloading (or copied it elsewhere and were exited) and decided the best place to demonstrate and sell the concept is in the most used console input and output standard functions.

    Edit: I realize my contempt for this decision is not evident here, so let me add that it was a terrible choice in their part indeed.

  • source
  • parent