摘要:
只需定义一个宏:#define foreach(container,i) for(bool __foreach_ctrl__=true;__foreach_ctrl__;)\for(typedef typeof(container) __foreach_type__;__foreach_ctrl__;__foreach_ctrl__=false)\for(__foreach_type__::iterator i=container.begin();i!=container.end();i++)就可以这样遍历STL容器:std::list<int> list;list.insert( 阅读全文