hosseinmoein / DataFrame

C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ using native types and contiguous memory storage
https://hosseinmoein.github.io/DataFrame/
BSD 3-Clause "New" or "Revised" License
2.54k stars 313 forks source link

Question on VectorPtrView #83

Closed nehcuh closed 4 years ago

nehcuh commented 4 years ago

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 here

inline 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 '>'?

hosseinmoein commented 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

nehcuh commented 4 years ago
    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!

hosseinmoein commented 4 years ago

Yes. they are defined in these operators

inline VectorPtrView &operator = (const std::vector<T> &rhs)
inline VectorPtrView &operator = (std::vector<T> &rhs)
nehcuh commented 4 years ago

Thanks! 😄