Templates and headers question

后端 未结 5 1751
迷失自我
迷失自我 2020-12-10 21:55

The compiler says it can\'t find the reference for the function when I do this:

// link.h
template 
    T *Link(T *&, T *(*)())

// link.c         


        
5条回答
  •  借酒劲吻你
    2020-12-10 22:19

    Templated implementations (not only definitions) have to be available at compile time.

    So, the full template code is normally put in the header file.

提交回复
热议问题