ошибка: «список» не является членом «стандартного» и ошибка: аргумент шаблона 2 недопустим

Я пытаюсь скомпилировать заголовочный файл, но получаю ошибки, которые не могу понять.

Я хочу создать структуру, которая содержит 3 карты:
-карта от отдельных слов до счета
-карта из пар слов в счет
-карта из отдельных слов в список следующих слов

Код в моем заголовочном файле:

#include <cstdlib>
#include <iostream>
#include <cstring>
#include <string>
#include <cctype>
#include <vector>
#include <algorithm>
#include <map>

typedef struct {

std::map<std::string, int> firstCounts;
std::map<std::string, int> pairCounts;
std::map<std::string, std::list<std::string>> follows; //You can use an iterator to retrieve the values stored in the list.

} LanguageModel;

И ошибки, которые я получаю:

>   LangModel.h:24:23: error: ‘list’ is not a member of ‘std’
>      std::map<std::string, std::list<std::string>> follows; //You can use an iterator to retrieve the values stored in the list.
>                            ^
>     LangModel.h:24:23: error: ‘list’ is not a member of ‘std’
>     LangModel.h:24:38: error: template argument 2 is invalid
>      std::map<std::string, std::list<std::string>> follows; //You can use an iterator to retrieve the values stored in the list.
>                                           ^
>     LangModel.h:24:38: error: template argument 4 is invalid
>     LangModel.h:24:44: error: expected unqualified-id before ‘>’ token
>      std::map<std::string, std::list<std::string>> follows; //You can use an iterator to retrieve the values stored in the list.

4

Решение

Вы забыли добавить

#include <list>
10

Другие решения

Как насчет #include <list>? Вам не хватает включения заголовка.

4

По вопросам рекламы [email protected]