HI,
One more small doubt from today's mail.
I have certain function which returns a pointer (sometimes a const
pointer from a const member function).
And certain member function needs reference (or better a const
reference).
for eg,
const PointRange* points = cc.points(ptAli gned);
cc.points is a const member function which returns a const pointer to
class PointRange.
This member function (from a different class) needs a const reference
to PointRange.
convolveNearEdg e(const PointRange& points,const Kernel& kernel, ...) {}
I am passing it the reference as,
convolveNearEdg e(*points,getKe rnel1(),velocit y);
I do not need a null in the function thus a reference. also I make
assure points passed to convolveNearEdg e is not null.
My question is, in the process do anywhere copy of the class occures
silently? I have no problem if it copies a pointer. But do not want a
copy of the class even temporarily.
Thus fundamentally , if I have a pointer, say int* x; *x = 10; then
int& y = *x is essentially a reference to the value pointed by x? and
without any overload?
Thanks
One more small doubt from today's mail.
I have certain function which returns a pointer (sometimes a const
pointer from a const member function).
And certain member function needs reference (or better a const
reference).
for eg,
const PointRange* points = cc.points(ptAli gned);
cc.points is a const member function which returns a const pointer to
class PointRange.
This member function (from a different class) needs a const reference
to PointRange.
convolveNearEdg e(const PointRange& points,const Kernel& kernel, ...) {}
I am passing it the reference as,
convolveNearEdg e(*points,getKe rnel1(),velocit y);
I do not need a null in the function thus a reference. also I make
assure points passed to convolveNearEdg e is not null.
My question is, in the process do anywhere copy of the class occures
silently? I have no problem if it copies a pointer. But do not want a
copy of the class even temporarily.
Thus fundamentally , if I have a pointer, say int* x; *x = 10; then
int& y = *x is essentially a reference to the value pointed by x? and
without any overload?
Thanks
Comment