CPP/Templates/FunctionTemplateHeaderOnly
From ProgrammingExamples
FunctionTemplate.cpp
#include <iostream> template<typename T> void PrintSomething(T something); int main(int, char*[]) { double a = 1.2; PrintSomething(a); // Sometimes have to do this: PrintSomething<double>(a); return 0; } template<typename T> void PrintSomething(T something) { std::cout << something << std::endl; } template void PrintSomething<double>(double);
CMakeLists.txt
cmake_minimum_required(VERSION 2.6) Project(FunctionTemplate) ADD_EXECUTABLE(FunctionTemplate FunctionTemplate.cpp)