S
suresh
Hi,
Could you help me in fixing the compile error in the following code:
#include <sstream>
#include <iostream>
using namespace std;
template<typename T, typename ...P>
class Mystrcat{
public:
Mystrcat(T t, P... p){init(t,p...);}
ostringstream & get(){return o;}
private:
ostringstream o;
void init(){}
void init(T t, P... p);
};
template<typename T, typename ...P>
void Mystrcat<T,P...>::init(T t, P ...p){
o << t;
if (sizeof...(p)) init(p...);
}
int main(){
Mystrcat<char*,char *> m("Amma","Namasivayah");
cout << m.get().str();
}
I get the error, no matching function for call to ‘Mystrcat<char*, char*>::init(char*&)’
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
Thanks
suresh
Could you help me in fixing the compile error in the following code:
#include <sstream>
#include <iostream>
using namespace std;
template<typename T, typename ...P>
class Mystrcat{
public:
Mystrcat(T t, P... p){init(t,p...);}
ostringstream & get(){return o;}
private:
ostringstream o;
void init(){}
void init(T t, P... p);
};
template<typename T, typename ...P>
void Mystrcat<T,P...>::init(T t, P ...p){
o << t;
if (sizeof...(p)) init(p...);
}
int main(){
Mystrcat<char*,char *> m("Amma","Namasivayah");
cout << m.get().str();
}
I get the error, no matching function for call to ‘Mystrcat<char*, char*>::init(char*&)’
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
Thanks
suresh