Why does use local variable in Mat::resize()?

in the function of Mat::resize(), line 1048 & 1049, where dose use local variable ‘part’, is it valid that assign ‘s’ to ‘part’? or ‘part’ here means the ‘Mat’ object itself ?

Read the function’s documentation and think based on that what the role of s is and what part represents.

I’m new for opencv, I’ve thought ‘part’ is just a local variable. so here the function rowRange return the address of the Mat itself, its function is similar to reference, assign s to part could modify the value of part, so that the value in rowRange of Mat will be modified.

the first line creates a slice/view over the new part of the matrix (it was resized). that new part hasn’t been initialized yet.

the second line has the form Mat = Scalar, which has special semantics. it assigns the scalar to every element of that view.

thank you. at the begin, i’ve thought the ‘part’ js just a local variable, after leaving it’s scope, it will destruct. now i think it’s just same as reference, it’s address is pointint at the part of Mat.