user partial template specialization to avoid branches within loop