merge the definition and implementation of template class