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)"
Asked
Active
Viewed 3,291 times
3

TahaOUARRAK
- 150
- 3
- 9
1 Answers
2
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

Evgeniy
- 2,481
- 14
- 24
-
Thanks , i didn't set the size of the matrix – TahaOUARRAK May 07 '17 at 01:16