使用模板有什么缺点? [英] What are the disadvantages of using templates?

查看:188
本文介绍了使用模板有什么缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些缺点是


  1. 其语法很复杂

  2. 编译器生成额外代码


推荐答案

它们很难验证。没有使用的模板代码往往很少被编译。因此,测试用例的良好覆盖是必须的。但测试是耗时的,然后它可能会导致代码从来不需要是鲁棒的第一。

They are hard to validate. Template code which doesn't get used tends to be seldom compiled at all. Therefore good coverage of test cases is a must. But testing is time-consuming, and then it may turn out the code never needed to be robust in the first place.

这篇关于使用模板有什么缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆