ベクトルをテンプレートにしようとしています。私のメインでは、次のものがあります。ベクトルとベクトル関数のテンプレートを使用
ここで、Wordはstd :: stringとintを含む構造体で、dataはstd :: stringです。私のヘッダファイルでは私が持っている:私は次のエラーを取得コンパイル時に
template <typename T>
std::vector<T> push_vector(std::string&);
は、しかし:
main.cpp: In function ‘int main(int, char**)’:
main.cpp:27:53: error: no matching function for call to ‘push_vector(std::string&)’
main.cpp:27:53: note: candidate is:
templates.h:13:20: note: template<class T> std::vector<T> push_vector(std::string&)
を私はテンプレート機能を実装していたときに、私は何かが欠けています知っているが、私はわかりません何。事前にお時間をいただきありがとうございます。
あなたの提案は最も理にかなっています。私は自分のコードでそれを実装し、それは完全に働いた。ありがとうございました。 –