今天看Scott Meyers大师的stl的用法,看到了我前段时间犯的一个错误,发现我写的代码和他提到错误代码几乎一模一样,有关stl容器删除元素的问题,错误的代码如下:std::vector<struct> mFriendList;...std::vector<struct>::iterator iter = mFriendList.begin();for ( ; iter != mFriendList.end(); ++iter){ if (...) mFr
总所周知.C++ STL中有个头文件,名为algorithm.即算法的意思. The header<algorithm>defines a collection of functions especially designed to be used on ranges of elements. 所以,要八一八这个头文件里C++11新增的几个算法,今天主要描写叙述的几个算法不改变容器中元素的顺序. 这里还要啰嗦一句,使用stl算法时,假设与lambda表达式组合使用,那么代码会更加简洁. fin
题目链接:http://codeforces.com/gym/100989/problem/D In this cafeteria, the N tables are all ordered in one line, where table number 1 is the closest to the window and table number N is the closest to the door. Each time a group of X people enter the cafe
在以下四种遍历过程中,前两种会抛出ConcurrentModificationException,而后两种方法是正确的. Department类: package com.sitinspring; import java.util.ArrayList;import java.util.Iterator;import java.util.List; public class Department { private String name; private List<Member> mem