次のコードのコンパイルエラーを修正するのを手伝ってもらえますか?
#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)
ありがとうsuresh