我认为我的cList有问题,但是我不知道如何解决它。我做对了吗?
course *a=new course(c);
list<course*> * cList = new list< course * > ;
(*cList).push_back(a);
void add_course(map<int, map<int, list<course *> * > *> &DB, int semester, int id, course c){
course *a = new course(c);
map<int, map<int, list<course *> * > *>::iterator it1;
it1 = DB.find(id);
if(it1!= DB.end())
{
map<int, list<course *> * >::iterator it2;
map<int, list<course *> * > * temp;
cout<<"oijnhbgh\n";
temp = (DB.find(id))->second;
if(temp == nullptr)
{
//(*temp).insert(pair<int, list<course *> *>(semester, nullptr));
list<course *> * cList = new list<course *>;
(*cList).push_back(a);
(*cList).clear();
(*cList).push_back(a);
(*temp)[semester] = nullptr;
// (pair<int, list<course *> *> (semester,cList));
}else
{
//somecode
}
}