Code duplication between typedefs and explicit instantiations

前端 未结 3 1173
独厮守ぢ
独厮守ぢ 2021-01-03 03:11

tree.h

template
class binary_operation : public node
{
// ... unimportant details ...

    unsigned evaluate() const;
         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-03 03:23

    I ask my self, why do you actually write a .cpp file as you have templates and they should go either all in the header file or in a seprarate file e.g ".icc", which holds the stuff from the cpp file. I am not sure but tempalates definitions should always NOT be in a compilation unit.

    See -> Storing C++ template function definitions in a .CPP file

提交回复
热议问题