volperossa
volperossa

Reputation: 1431

DLIB C++ how to make an std::vector of dlib::matrix

I need a std::vector of dlib::matrix, but I don't know at compile time the matrix size; documentation tells me:

// (Note that if you don't know the dimensionality of your vectors at compile time
// you can change the 2 to a 0 and then set the size at runtime)
typedef matrix<double,2,1> sample_type;

ok, but I need a std::vector of this objects, so what template argument I have to set on my std::vector? example (get_dimensionality() gives me the right dimensionanlity):

matrix<double,0,1>  m;
m.set_size(get_dimensionality(),1);
std::vector<matrix<double,????????,1> v;
v.push_back(m);

what number at ???????? ?

Upvotes: 1

Views: 905

Answers (1)

Uriel
Uriel

Reputation: 16214

You have the answer by your question. Use the vector as

std::vector<matrix<double, 0, 1> v;

so you can set each element size as it runs, the same you do with the matrices themselves.

Upvotes: 2

Related Questions