#include <afxtempl.h>
#include <string>
int main()
{
CList<std::string,std::string> lst;
std::string str;
POSITION pos;
for(int i = 0; i < 10; i++){
str.append("a");
lst.AddTail(str);
}
pos = lst.GetHeadPosition();
while(pos != NULL){
str = lst.GetNext(pos);
// 抜き取りテスト
if(str.compare("aa") == 0){
// aaa を抜き取る
lst.RemoveAt(pos);
}
printf("%s\n",str.c_str());
}
pos = lst.GetHeadPosition();
while(pos != NULL){
str = lst.GetNext(pos);
// 抜き取りテスト
if(str.compare("aaaa") == 0){
// aaaa を抜き取る
lst.GetPrev(pos);
lst.RemoveAt(pos);
}
printf("%s\n",str.c_str());
}
return 0;
}
最終更新:2009年02月17日 13:31