Subscript operator overload and reference to pointer error?

All "no match for '...'" errors mean the arguments in the call aren't compatible to the declared arguments for any functions or operators, so you should look to the argument declarations. Make argument to operator an unsigned int. Similarly, passing the returned pointer by reference is quite odd; not necessarily bad, but highly suspect.In general, non-compound types should be passed by value.

Actually I tried that but since It didn't match the exact signature, I tried this one... – Maxime Nov 4 at 0:55.

First of all, there is no need to pass so many things by reference. Taking the unsigned int by value would almost certainly not slow things down; same about the reference to pointer. This could be the problem, but I doubt it; I don't see why 0 wouldn't convert to a unsigned int const&.

Another possibility is that the image is actually const, but you failed to mention that in your paste. Subscript operators generally come in pairs; you need to declare another one as Color const* operator ( unsigned int I ) const;. Note that img0 is what is being complained about, so the = Color(1.0, 1.0, 1.0); is probably not an issue (unless there's some SFINAE error I'm missing).

Finally, make sure you haven't specialised Image for double. EDIT: By the way, returning Color*& has a severe disadvantage; someone could do img0 = 0, which was probably not the way the class was meant to be used.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions