, , . , - .
, , " - ", / .
,
1) ( "header.h" ), struct foo , ,
template <typename T>
struct foo
{
foo ();
};
2) cpp ( "a.cpp" ) main(), foo<int>
#include "header.h"
int main ()
{
foo<int> fi;
}
3) cpp ( "b.cpp" ), foo
#include "header.h"
template <typename T>
foo<T>::foo ()
{ }
, ?
( clang++ -c -o a.o a.cpp clang++ -c -o b.o b.cpp) (clang++ -o a.out a.o b.o), : undefined foo<int>::foo()
?
- , "b.cpp" , , "a.cpp" foo<int>, foo<int>::foo().
, , , "b.cpp" , , foo<int>, "b.cpp"
#include "header.h"
template <typename T>
foo<T>::foo ()
{ }
template struct foo<int>;
foo<long> , "b.cpp" .
(IMHO), , foo<T>.
(IMHO) struct/class (IMHO, ), /