Disclaimer: I know that nothing actionable can come of this, but i’d like to understand some design decisions.
My impression is that direct indexing via vector[index] is seldom what I want. If it’s not guaranteed that the index is in bounds, get is better. If I’m sure that the index is in bounds, I tend to use get with expect to communicate that and get better errors if I was wrong. If I’m totally sure, I use get_unchecked to circumvent the bound check.
When I look at other peoples code I have a similar impression. The only places I see uses are: Taking slices (imo rare enough to do that with a method) and in direct translations from C code (which leads often to slower code in comparison to a solution with iterators)
It seems peculiar to me to spend syntactic sugar on that.
So, do we have the index operator just because we inherited it from C/C++ or is my impression wrong?