STL like container typedef shortcut?

后端 未结 7 1198
有刺的猬
有刺的猬 2021-01-26 22:56

A common pattern with STL containers is this:

map map;
for(map::iterator iter = map.begin(); iter != map.end(); ++iter)
{
  .         


        
7条回答
  •  执念已碎
    2021-01-26 23:37

    A future version of the C++ standard (known as C++0x) will introduce a new use for the auto keyword, allowing you to write something like the following:

    map map;
    for(auto iter = map.begin(); iter != map.end(); ++iter)
    {
      ...
    }
    

提交回复
热议问题