vectors

c++ how to make two vectors one with data the other points and reads only

In C++ I have 2 STL vectors A and V. A has data and is able to change it, V only points to data but reads only and can't modify it. So if these two vectors are inside a class what will be the syntax of Variables definition assigning A reference into V get_A() and get_V() will it return a reference or a pointer? Also If I have other...

c++ convert matrix into row pointer vector

vector<vector<int> > mymatrix; vector<int> *ptr_vec; How do I make the ptr_vec point to the vectors which are inside mymatrix one after another. In more details Let's say mymatrix.at(0).size() gives 10, and mymatrix.at(1).size() gives 14 ..if I go ptr_vec->at(15) it should give me the fifth member in mymatrix.at(1) hope it doesn't conf...

What is a 3D Vector and how does it differ from a 3D point?

Does a 3D vector differ from a 3D point tuple (x,y,z) in the context of 3D game mathematics? If they are different, then how do I calculate a vector given a 3d point? ...

Trouble creating a map with vector as key and custom class as value.

Hey everybody, I have created the abstract class below to evaluate a board position of simple games. The abstract class is overridden by each derived class so that only the evaluate function is defined in game.h I am trying to make my program more efficient by using memoization, but I can't get my map to work correctly. The compiler th...

How does this code work?

I found this piece of C++ code on a forum that I can't fully understand. Since I don't have their library that performs matrix/vector math, I need to manually figure it out and replicate the functionality. Calculate Euler rotation angles between 2 vectors .. we use Rodrigues formula vector $V1 = << my first vector >>; vector $V...

c++ vector of iterators

I understand that I can point to number of vectors std::vector<int> using for loop on one vector<int*> onev_point_2_all etc.. but how do i do that using iterators is there a way of creating a vector of iterators instead of a vector of pointers ? ...

Why is Java's polymorphism failing to catch the right method when choosing between object and vector?

I have two similar methods. One is intended to handle objects, the other vectors: @SuppressWarnings("unused") private void printRows(PrintWriter out, Vector<?> dataOb, String[] columns, String[] columnType, Hashtable<?, ?> columnAccessors, String trOptions, String tdOptions) throws ServletException { ...