c++: further optimize tsubst_template_decl