I'm writing a simple template which stores values in an array checking there's no duplicate.
I overloaded [] operator so it can be used just like a regular array :
T operator [] (int index) { return _array[index]; }
But that doesn't work if I want to directly change values, of course I could write some changeVal(int index, T value) function but it would be fancier if I could use the = operator to do it. Can I overload multiple operators at once ? like :
operator [] = (int index, T val) { _array[index] = val; }
That doesn't compile for me : is there some way to achieve that ?
Apparently I'm the only goon who have thinked of that, or maybe the answer is just hidden inside some of the millions questions with generic sentence like "Overloading operators question" but I won't spend my whole life browsing through those ( did already got quite older doing it ).
Thanks a lot everybody, have a nice day !!!
EDIT : (see below comment) Even if my main problem is solved, an answer to the main question - is it possible and how (even with some trick or whatever) would still be appreciated - that would be quality info for sure !!! Thanks everyone !!!