void Filler::GetCluster(Pos pos, std::unordered_set<int>& cluster_out) { if (IsOutside(pos) || visited_.find(pos.GetHash()) != visited_.end() || piece_index_.find(pos.GetHash()) == piece_index_.end()) { return; } visited_.insert(pos.GetHash()); cluster_out.insert(piece_index_[pos.GetHash()]); for (const auto& direction : directions_) { GetCluster({ pos.x + direction.first, pos.y + direction.second }, cluster_out); } }