[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: c++: 2D array

Hi all

What's the function prototype for overloading [][]operator?

I think of following..

T&        operator[](int i);
T*      operator[](T& ptr);

What do you think?


"Sarcar, Shourya (MED)" wrote:

> Guh !
>         A slightly bloated but robust code follows . Purify says no memory
> leaks ( 0 bytes :) and that __is_good__ !
> However, not that the inhyerent pointer manipulation in C makes this program
> susceptible to access beyond array bounds. Couldn't figure a way to get
> across that :( In all, I should think that this is pretty good C++ code :)
>         I ahve tried to keep the C++ code as simple as possible. Pleae
> suggest modifications to effect robustness, usability.
> Regards,
> Shourya