this[j]
is hardly ever the right thing to do. It can only be correct, if *this
happens to be a subobject within an array, and have at least j
siblings after it. this[j]
is equivalent to *(this + j)
. As you can see, it dereferences a pointer to j
th sibling after *this
.
I suspect, that you instead intended to access the elements of the buffer by calling Vector::operator[]
. You’d do that by dereferencing the pointer first: (*this)[j]
.