Reputation: 150
What is the equivalent of std::vector::push_back()
, in matrix<float,0,1>
I tried M(i) = xx,xx
, but the program crash and i get "Segmentation fault (core dumped)"
Upvotes: 3
Views: 3445
Reputation: 2511
Dlib's matrices have fixed size, they are not auto-extending like STL's vectors
So you can set matrix size and use is:
dlib::matrix<double,3,3> m(num_rows, num_cols); // at compile time
dlib::matrix<double> m(num_rows, num_cols); // at construction time
dlib::matrix<double> m; m.set_size(num_rows, num_cols) // at run time
m(1,2) = 1;
More information is in Dlib examples
And possible reason of segmentation fault is using matrix of unknown size
Upvotes: 2