您能帮我修复以下代码中的编译错误吗:
#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();
}
我得到错误,没有匹配的函数调用
‘Mystrcat<char*, char*>::init(char*&)’
注:候选人是:
void Mystrcat<T, P>::init() [with T = char*, P = char*]
void Mystrcat<T, P>::init(T, P ...) [with T = char*, P = char*]
gcc 版本 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
谢谢肯定