& pointer operator help

Sep 21, 2014 at 12:25pm
So heres this line I have:

 
try {  warpPerspective(*((oclMat*) src),*((oclMat*) dst),*((Mat*)M),*((Size*) dsize), flags, borderMode,(Scalar&) borderValue);} 


What does the Scalar& mean? I know if & comes before, it means its "the adress of". Here its used after a type in a casting operation, does the & mean anything or should i take it to be just part of the Scalar name? (doesnt sound likely :/)

Thanks in advance
Last edited on Sep 21, 2014 at 12:27pm
Sep 21, 2014 at 12:41pm
Oct 3, 2014 at 9:00pm
I went over this but for what I understood a reference starts with a &, doesn't end with it. So this looks more like a casting operation on borderValue to the Scalar& type, not a creation of a reference value. So I'm still not sure what the & does to Scalar..
Oct 3, 2014 at 9:43pm
reference starts with a &, doesn't end with it
No. Reference come after type:
1
2
int x;
int & y = x; //y refers to x 


this looks more like a casting operation on borderValue to the Scalar& type
Correct. Scalar& names type reference to Scalar. I do not know why they used unsafe C-cast, but your code will be valid only if borderValue has type of Scalar, or derived from it.
Oct 12, 2014 at 4:27pm
thanks again miinipaa
Topic archived. No new replies allowed.