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
[–] 7 points 11 hours ago (3 children)

I haven't kept up to date with C++ development in the last 16 years, I only recognize the first two of those four.

  • source
  • hideshow 3 child comments
  • [–] [S] 7 points 10 hours ago (1 child)

    You can overload the indexing operazor "[]" (std::vector does this for example), and since c++23 this operator can have more than one argument.

    The last one is a constructor call with an overloaded conversion operator. The {} syntax is possible since c++11 I think. The conversion operator was already available before that

  • source
  • parent
  • hideshow 1 child comment