I usually use .fill()
with 1D arrays and vectors but it seems to not work with multidimensional ones.
I've seen around a lot of ways to fill them, but i wonder what the most efficient is.
std::array<std::array<bool, 3>, 3> wasPlayed;
wasPlayed.fill(false);
This doesn't work, what would be the most performant way of filling wasPlayed
with false
values?
I played a bit and found this way:
for(int i = 0; i < 3; i++){
wasPlayed[i].fill(false);
}
This seems to work but is it efficient?