Closed nehcuh closed 4 years ago
The whole point of view vector objects is to have references (not copies) to an original data vector. So the view vector content is always pointers
inline VectorPtrView(const std::vector<T> &rhs) { *this = rhs; }
inline VectorPtrView(std::vector<T> &rhs) { *this = rhs; }
Such codes mean VectorPtrView
will hold pointer of rhs
?
Sorry for my bad cpp program skill and a lot of thanks for your patience!
Yes. they are defined in these operators
inline VectorPtrView &operator = (const std::vector<T> &rhs)
inline VectorPtrView &operator = (std::vector<T> &rhs)
Thanks! 😄
Sorry to reopen this question.
Let's assume that we've constuct a VectorPtrView of a vector, then, using method of VectorPtrView such as
at
,[]
, which would may result in errors. The method of at which I quote your realization hereinline reference at(sizetype n) { return (*(vector[n])); } is not to give the element of the Vector, instead, it's assuming the element is a pointer.
Is there any misunderstanding?
Also, is
VectorPtrView
lack of realization of operator '!=' and '>'?