Function templates in C++

A reference to myself.

Function templates have two faces. Either they are a member of a non-template class, or they are free functions in the global or some namespace.

These are a member of a non-template class, with function templates.

// filename: interface.hpp
class interface
{
protected:
	template<typename RESULTS, typename DATA>
	void insert(RESULTS &results, const DATA &data);
}
// filename: interface.cpp

#include "interface.hpp"

// Full specialization
template<>
void interface::insert<>( Results &results, const Data &data )
{
	// do stuff
}
VN:F [1.9.13_1145]
Rating: 0.0/5 (0 votes cast)
Share

Leave a Reply

Leave a Reply
  • (required)
  • (required) (will not be published)