Why can't templates be declared in a function?

后端 未结 7 705
甜味超标
甜味超标 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 12:42

    My guess is that it is hard to implement, that's why it is not allowed (in Standard C++03). Writing class templates outside of functions is an acceptable solution from the other hand.

提交回复
热议问题