I have a class PixelVector whose constructor signature looks like:
PixelVector(unsigned int r=0, unsigned int c=0, unsigned int max=255);
In another Image class I have a private variable, PixelVector pixels. I initialize it with:
pixels(height,width,readMax);
where all the parameters have the correct type and are guaranteed to be already initialized.
I want to pass these by value but when I compile I get the error:
image.cpp:185:30: error: no match for call to ‘(PixelVector) (unsigned int&, unsigned int&, unsigned int&)’
Why is the compiler thinking I'm passing the values by reference. How do I force it to pass by value?
Aucun commentaire:
Enregistrer un commentaire