Reputation: 5967
I am translating a c++ code to another language and am having difficulties understanding some code block in c++ code.Here is the line i am having trouble understanding the concept.
here is code snippet :
DynamicUint &operator=(const DynamicUintView<Iterator> that) &
{
view(*this) = that; // <== this line seems weird
return *this;
}
in view(*this) = that;
what i've grasped is it is trying to initialize view
member variable by (*this)
value as parameter but as far as i saw there is no constructor taking one arguments in DynamicUintView
class.could somebody shed some light on this?
Upvotes: 1
Views: 106
Reputation: 168988
view
is a type alias for DynamicUintView<iterator>
, so this code does the following:
DynamicUintView<iterator>
object by invoking the implicit DynamicUintView<iterator>
conversion operator, which in turn invokes the two-arg constructor of DynamicUintView<iterator>
.view::operator=
is invoked on this temporary object, passing that
as the argument.Upvotes: 2