Most important things about C++ templates… lesson learned

前端 未结 12 1465
暗喜
暗喜 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:38

    This may not be popular, but I think it needs to be said.

    Templates are complicated.

    They are awesomely powerful, but use them wisely. Don't go too crazy, don't have too many template arguments... Don't have too many specializations... Remember, other programmers have to read this too.

    And most of all, stay away from template metaprogramming...

提交回复
热议问题