Cześć
Mam kod do wypisywania zawartości wektora 2D:
#include <cstdio>
#include <vector>
#include <algorithm>
void printMatrix(std::vector<std::vector<bool> >& matrix) {
int i, j;
for(i = 0; i < matrix.size(); ++i) {
printf("%2d: ", matrix[i].size());
for(j = 0; j < matrix[i].size(); ++j) {
printf("%d,", matrix[i][j]);
}
printf("\n");
}
printf("\n");
fflush(stdout);
}
int main()
{
std::vector<std::vector<bool> > matrix(10, std::vector<bool>(15, true));
printMatrix(matrix);
return 0;
}
Nie mam pojęcia czemu ale ten kod mi się wysypuje [???]
jak zmienie sygnaturę funkcji z:
void printMatrix(std::vector<std::vector<bool> >& matrix)
na
void printMatrix(const std::vector<std::vector<bool> >& matrix)
to działa dobrze. Czy ktoś wie co jest nie tak?