我知道Java通过擦除实现了参数多态(泛型).我明白擦除是什么.
我知道C#通过具体化实现参数多态.我知道那可以让你写作
public void dosomething(List<String> input) {} public void dosomething(List<Int> input) {}
或者您可以在运行时知道某些参数化类型的类型参数是什么,但我不明白它是什么.
c# generics reification
通过阅读此问题,例如,我理解了为什么在空间或核电站等辐射较高的环境中不建议动态分配或例外的原因。关于模板,我不知道为什么。你能给我解释一下吗?
考虑到这个答案,它说使用起来很安全。
注意:我不是在谈论复杂的标准库内容,而是针对性的自定义模板。
c++ embedded templates fault-tolerance
如何学习c ++泛型编程和模板?推荐一些关于这个主题的好书.
c++ generics templates
c++ ×2
generics ×2
templates ×2
c# ×1
embedded ×1
fault-tolerance ×1
reification ×1