Haoxiang’s Blog
Skip to content
  • Home
  • Blog Posts
  • (中文)
  • (EN)
  • About
  • RSS
  • Messages

map

There is one post tagged map.

STL map operator[] not const

STL里Map的Operator[]和其它的Container不太一样。 因为Map的Operator[]可以提供这种操作: map testMap; testMap[“a”] = “b”; 所以Map的Operator[]返回的是T&,而不是const T& 如果需要得到const reference,可以这样: map testMap; const string& constMember = testMap.find(“a”)->second;

in Blog Posts, Solution, 中文 | 2012/03/11 | Comment
这个网站使用的主机 (我的推广链接)
Independent Publisher empowered by WordPress