completed code generation for template classes