Data pointer for efficient casting

  allocation, c++, pointers, types

I am using different types of data : say double *, double **, Eigen::Matrix< Index, Eigen::Dynamic, Eigen::Dynamic >, std::vector …

I am using different codes, and they mix those types, so I would like to avoid copies of datas when passing from one type to another, e.g. say I have double * positions, and in another part of code I need std::vector vectorOfPositions, and I would like to avoid costly initialiazation of vectorOfPositions…
Similarly, Eigen with the method Map, seems to offer a solution. I wonder if there is a general way of doing so …

Sorry if the question is badly asked, I will try to improve it when I will have clearer vocabulary about it…
Thanks in advance for those helping!

Source: Windows Questions C++

LEAVE A COMMENT