I've created a class to simulate the behavior of vector of int, because every time I read or write some value, also a read and write counter should be incremented to keep track of its usage. I can’t change the code in main.cpp other than from the type “int” to the type “MyInt”, that's why I'm trying to overload the [] operator to read inside the brackets and pass the operation to a second one, using a wrapper class. The error I got is:
no match for ‘operator=’ (operand types are ‘MyInt’ and ‘int’)
so it looks like that the intercept of the assignment of the wrapper class doesn't work. I've also overloaded the "new []" operator for the dynamic declaration and it seems to work properly. Any suggestion?