I have a header file : abc.h and abc.template file and i want to use the template feature, how can i modfiy following program to change it completely in template
abc.h file have
#idndef d_h
#define d_h
# include header files - cstdlib, iostream and string
namespace xyz
{
template<class d>
class p;
template<class d>
std::ostream& operator <<(std::ostream& ou, const p<d>& a);
template<class d>
class p
{
public:
p() { } //constructor
~p(); //destructor
void abc();
void pattern(std::string, const bool& t);
friend std::ostream& operator << <d> (std::ostream& ou, const p<d>& a);
};
}
#include"abc.template"
#endif
AND the abc.template file have
#include <cstdlib> other header too
namespace CSCI301_double
{
template <class d>
Double< d>::~Double()
{
}
template <class d>
void p<d>::search_s(string srch, const bool& stat)
{
// use so the argument srch and stat over here,,
// how to use it
}
}
my question is how to change the srch and stat argument to the template type
i have tried using
template<class d, class c, class l>
void p<d>::search_s(c srch, const l& stat)
srch is the std:: string input from the keyboard
but the g++ compiler generate the error
and how to chagne it to template type in both the dot.h and dot.template file