C++迷惑部分

C++ confused parts

Question1 return of what?

map<string,int> getTestedmapRef(){
  map<string,int> counterMap;
  counterMap.insert({"word1",2});
  counterMap.insert({"word2",3});
  counterMap.insert({"word3",1});
  return counterMap;
}

map<string,int>* getTestedmap(){
  map<string,int> *counterMap=new map<string,int>();
  counterMap->insert({"word1",2});
  counterMap->insert({"word2",3});
  counterMap->insert({"word3",1});
  return counterMap;
}
posted @ 2015-12-18 10:22  RobinMeng  阅读(203)  评论(0编辑  收藏  举报