Why can't templates be declared in a function?

后端 未结 7 701
甜味超标
甜味超标 2020-12-01 12:28

Reading C++ Templates: The Complete Guide and it says

Note that templates cannot be declared in a function

It does not give e

相关标签:
7条回答
  • 2020-12-01 13:00

    The only time this would be useful would be if you created multiple instances of the template with different types withing the one function. Move your private classes out of your functions anyway. If that starts to clutter up your classes then they are too big and need to be refactored.

    0 讨论(0)
提交回复
热议问题