Most important things about C++ templates… lesson learned

前端 未结 12 1449
暗喜
暗喜 2021-01-30 18:52

What are most important things you know about templates: hidden features, common mistakes, best and most useful practices, tips...common mistakes/oversight/assumptions

12条回答
  •  执笔经年
    2021-01-30 19:28

    It's important to understand separate compilation and the possibility of resulting executable size increases. If you instantiate the template with the same type in several C++ files, you will get the type reproduced multiple times, at least on some compilers.

提交回复
热议问题