【发布时间】:2016-02-29 00:55:21
【问题描述】:
我尝试创建一个集合来存储文本文件的某些单词。然后我想从我已经制作的地图中删除这些单词。我已经成功地制作了一组来存储这些单词,但我无法将它们从地图中删除。此外,我不能使用循环语句(如 for 循环或 while 循环)。
#include <iostream>
#include <iomanip>
#include <fstream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <list>
ifstream stop_file( "remove_words.txt" );
ofstream out( "output.txt" );
set <string> S;
copy(istream_iterator<string>(stop_file),
istream_iterator<string>(),
inserter(S, begin(S)));
//copy: copy from text file into a set
remove_if(M.begin(), M.end(), S);
//remove: function I try to remove words among words stored in a map
//map I made up is all set, no need to worry
【问题讨论】:
标签: c++ stl iostream fstream remove-if