Having template function defination in cpp file - Not work for VC6
- by Yan Cheng CHEOK
I have the following source code :
// main.cpp
#include "a.h"
int main() {
A::push(100);
}
// a.cpp
#include "a.h"
template <class T>
void A::push(T t) {
}
template void A::push(int t);
// a.h
#ifndef A_H
class A {
public:
template <class T>
static void push(T t);
};
#endif
The code compiled charming and…