Is it possible to have a generic function declaration in a header file and the subsequent definition in a definition file?
I'd like to do something like this
HEADER FILE:
#ifndef PROCEDURES_H
#define PROCEDURES_H
template<class T>
T max(const T&, const T&);
#endif
DEFINITION FILE:
#include "procedures.h"
template<class T>
T max(const T& left, const T& right)
{
return left > right ? left : right;
}
This results in a linker error.
Of course if I just put everything in the header it works fine.