描述:
            使用map中的find()方法  VC6中
编译提示出错:
--------------------Configuration: AutoParticiple - Win32 Debug--------------------
Compiling...
Dictionary.cpp
F:\Project\Visual C++\AutoParticiple\Dictionary.cpp(30) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::_Tree<int,struct std::pair<int const ,int>,struct std::map<int,int,struct std::less<int>,cla
ss std::allocator<int> >::_Kfn,struct std::less<int>,class std::allocator<int> >::const_iterator' (or there is no acceptable conversion)
F:\Project\Visual C++\AutoParticiple\Dictionary.cpp(31) : error C2679: binary '!=' : no operator defined which takes a right-hand operand of type 'class std::_Tree<int,struct std::pair<int const ,int>,struct std::map<int,int,struct std::less<int>,cl
ass std::allocator<int> >::_Kfn,struct std::less<int>,class std::allocator<int> >::const_iterator' (or there is no acceptable conversion)
Error executing cl.exe.
AutoParticiple.exe - 2 error(s), 0 warning(s)
源码如下
Dictionary.h
#ifndef _Dictionary_H_
#define _Dictionary_H_
#pragma warning(disable: 4786)
#include <iostream>
#include <fstream>
#include <string>
#include <map>
using namespace std; 
const string DICTIONARYNAME("words.dictionary");
class Dictionary {
public:
	Dictionary(); 
	~Dictionary(); 
	bool IsWord(string&) const; 
	int getIndex(string&) const;
	int getFrequency(int) const;
private:
	map<string, int> wordDictionary;
	map<int, int> frequencyDictionary;
	void OpenDictionary();
};
#endif
Dictioanry.cpp
#include "Dictionary.h"
Dictionary::Dictionary() 
{
	OpenDictionary();
}
Dictionary::~Dictionary() 
{
	wordDictionary.clear();
	frequencyDictionary.clear();
}
/* Esitimate whether a word in word dictionary. */
bool Dictionary::IsWord(string& word) const
{
	if(wordDictionary.find(word) != wordDictionary.end())
		return true;
	return false;
}
int Dictionary::getFrequency(int id) const
{
	map<int, int>::iterator position;
	position =  frequencyDictionary.find(id);
	if(position != frequencyDictionary.end())
		return (*position).second;
	else
		return -1;
}
void Dictionary::OpenDictionary()
{
	FILE *fpDictionary;
	if((fpDictionary = fopen(DICTIONARYNAME.c_str(), "r")) == NULL) {
		cout << "Cannot open the Dictionary file!";
		exit(1);
	}
	int id, frequency;
	char word[16];
	while(fscanf(fpDictionary, "%d %s %d", &id, word, &frequency) != EOF) {
		wordDictionary.insert(pair<string, int>(word, id));
		frequencyDictionary.insert(pair<int, int>(id, frequency));
	}
	fclose(fpDictionary);
}
如何解决?

