I want to declare function, with template value, in header file. And implementation it in cpp file and call the function from main.
But i want to do it without using class.
How do i do it?
Thanks
temp.hpp :
#ifndef TEMP_HPP
#define TEMP_HPP
template
void show( T a);
#endif /* TEMP_HPP */
temp.cpp :
#include
#include "temp.hpp"
template
void show( T a)
{
std::cout << "a:" << a << std::endl;
}
main :
#include
#include "TextTable.h"
#include "temp.hpp"
int main()
{
int a = 5;
float b = 2.5;
show(a);
return 0;
}
No comments:
Post a Comment