put template member function .cpp file

8 views
Skip to first unread message

Z.L

unread,
Aug 3, 2015, 5:14:16 PM8/3/15
to Caffe Users
Hi all,
 
As we know, if we use the template member function we need to put it in header file, for example
//in test.hpp
template<typename Dtype>
class A{
     public:
        A(Dtype a, Dtype b)
};
A<Dtype>::A(Dtype a,Dtype b){
.....
}
 
if we did not put the definiation in the header file, it is likely to get linker error. But when I can caffe code, especially, src/caffe/layers.cpp and include/caffe/layers.hpp, the declaration and definition of template member function in .hpp and .cpp files, how can it be possible?
 
Does anyone have same concern? or anyone has any thoughts on this?
 
Reply all
Reply to author
Forward
0 new messages