    #include <algorithm>
    #include <iostream>

    int main () {
      const std::size_t board_size = 16;
      char board [board_size] = {
        0, 2, 0, 4,
        2, 4, 8, 2,
        0, 0, 8, 4,
        2, 0, 0, 2
      };

      // Initialize a zero-filled vector of the appropriate size.
      std::vector<int> zeroes(board_size);

      // Fill the vector with index values (0 through board_size - 1).
      std::iota(zeroes.begin(), zeroes.end(), 0);

      // Remove the index values that do not correspond to zero elements in the board.
      zeroes.erase(std::remove_if(zeroes.begin(), zeroes.end(), [&board] (int i) {
        return board[i] != 0;
      }), zeroes.end());

      // Output the resulting contents of the vector.
      for (int i : zeroes) {
        std::cout << i << std::endl;
      }
    }