make heap a template class