を読んで構築しようとしたときに、私は次のエラーを取得しています:「無効な初期化」エラーマップから
error: invalid initialization of non-const reference of type "std::vector<......"
コード:
class Config {
public:
std::vector<string>& GetValuesForList(std::string listName);
private:
std::map<std::string, std::vector<string> > lists;
};
inline std::vector<string>&
Config::GetValuesForList(std::string listName) {
return lists.find(listName);
}
を、私はそれをよく読んでと思わましたC++の一時的なものだからですが、それを解決する方法がわかりません。どんな助けでも大歓迎です。
ありがとうございました。
ありがとう、それは完全に働いた。 – MeanwhileInHell