I want to copy columns from a std::vector<std::vector<double> >
into another std::vector<std::vector<double> >
in C++. This question answers that but only deals with the case where all the columns are in a sequence. In my case, the inner std::vector
has 8 elements {C1, C2, C3, C4, C5, C6, C7, C8}. The new object needs to contain {C4, C5, C6, C8} and all the rows. Is there a way to do it directly?
After this step, I will be manipulating this to remove the duplicate rows and write it into a file. Also, please suggest which activity to do first (deleting "columns" or duplicates).
Just to put things in perspective - the outer std::vector
has ~2 billion elements and after removing duplicates, I will end up with ~50 elements. So, a method that is faster and memory efficient is highly preferred.