I'm making my own little project. Recently, as to add some features, I decided to add these 2 functions. Here is the code
//filename: tictactoe.cpp
bool is_empty(char cell[][3]){
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){
if (cell[j][i] != '\0') return false;
}
}
return true;
}
bool strtest(char cell[3][3]){
if (is_empty(cell)) return true;
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){
if (cell[j][i] == '\0') return false;
}
}
return true;
}
Here is the error in it's full glory (compiled with g++ version 10.3.0 on Ubuntu 21.04):
tictactoe.cpp: In function ‘bool strtest(char (*)[3])’:
tictactoe.cpp:68:6: error: reference to ‘is_empty’ is ambiguous
68 | if (is_empty(cell)) return true;
| ^~~~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/nested_exception.h:40,
from /usr/include/c++/10/exception:148,
from /usr/include/c++/10/ios:39,
from /usr/include/c++/10/ostream:38,
from /usr/include/c++/10/iostream:39,
from tictactoe.cpp:1:
/usr/include/c++/10/type_traits:715:12: note: candidates are: ‘template<class _Tp> struct std::is_empty’
715 | struct is_empty
| ^~~~~~~~
tictactoe.cpp:59:6: note: ‘bool is_empty(char (*)[3])’
59 | bool is_empty(char cell[][3]){
| ^~~~~~~~
Compilation failed.
Do you have any idea how to fix this? I tried and can't find anything about this error on SO. The headers I use are only <ncurses.h> and some standard headers.