There is 2 parts to the answer you're looking for, i.e.
- The matrices.
- The container holding all these matrices.
So, for the matrices: If you are planning on doing linear algebra operations I'd recommend using some special libraries, such as Armadillo which comes with a lot of pre-defined matrix functions (e.g. eigenvalue, matrix multiplication, etc.). If it's just basic 2D data storage with no special operation, then I'd recommend using a STL vector of vector to represent your matrices. These containers are dynamic in size (can be changed at will during execution) and all elements are accessible by index. As Patrick said, more info can be found here: cppreference.com.
An example of a 3x3 matrix of integer filled with 1s would be
std::vector< std::vector<int,int> > matrix(3,std::vector<int>(3,1));
Then, you have to store these matrices somewhere. For this, it is really going to depend on your needs. The simplest solution would be a vector of matrices (so a vector of vector of vector, really). Your code would behave exactly as in R, and you would be able to access matrix by index. The equivalent C++ code is
#include<vector>
using namespace std;
typedef vector< vector<int,int> > int_matrix_t;
...
vector<int_matrix_t> my_vector_of_matrices(10);
for (int i = 0; i<10; ++i) {
my_vector_of_matrices[i] = some_function_that_outputs_a_matrix(i);
}
But there is a lot of other container available. You should survey this chart and choose for yourself!