I overloaded operator <<
for matrix output.
std::ostream& operator << (std::ostream& os, const Tic& b)
{
for (int i = 0; i < b.rows; i++)
{
for (int j = 0; j < b.cols; j++)
os << std::setw(5) << b.board[i][j] << " ";
os << '\n';
}
return os;
}
Also, I created a small function for printing.
inline void print_matrix (const Matrix& _obj)
{
cout << _obj;
}
Can I use inline for
print_matrix
function?Will inline be used for overloaded operator, or does the compiler apply this only for
cout
and only then will call<<
as another function?