The question is whether it is possible to overload [ ][ ] .
Well in normal circumstances like vector< vector < int > > , we are overloading the [ ] opertor .
But in cases where if define a special meaning to [ ][ ] is it possible to have such an operator
There is no special [][] operator; it's operator[] applied to the result of another operator [].
You can give special meaning to [][] construct by having the first operator returning a special temporary object, which also has [] operator.
No, you will have to overload []
to return a value which itself has []
overloaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With