I wasn’t sure which word to use so wikipedia to the rescue https://en.wikipedia.org/wiki/Bracket
- 1 Post
- 4 Comments
Joined 3 years ago
Cake day: June 27th, 2023
You are not logged in. If you use a Fediverse account that is able to follow users, you can follow this user.
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
Good point regarding the {} implementation.
I disagree slightly regarding your point that these aren’t function calls. Yes technically they are different things but effectively they are functions, I cann pass arguments and get a result based on some operations.
Of course not all of these can do anything but only the constexpr value is actually pretty limited. The other ones are straight up functions


I don’t really know myself, probably the many footguns and complexities. Like taking a reference to a value in a vector and then resizing the vector, boom undefined behaviour. There a re a lot of things like this. Maybe also the verbosity and multie ways to do things. Look at the linked code, there is a lot of overhead to the function definitions, sure there is a point to all of it and I put it there for a reason, but to people less familiar to the language it is probably quite offputting.
Personally I like the language, second only to rust for me