Ray's playground

 

Item 44: Factor parameter-independent code out of templates(Effective C++)

  • Templates generate multiple classes and multiple functions, so any template code not dependent on a template parameter causes bloat.

  • Bloat due to non-type template parameters can often be eliminated by replacing template parameters with function parameters or class data members.

  • Bloat due to type parameters can be reduced by sharing implementations for instantiation types with identical binary representations.

posted on 2011-04-06 20:27  Ray Z  阅读(204)  评论(0编辑  收藏  举报

导航