64,654
社区成员
发帖
与我相关
我的任务
分享
#include <map>
#include <string>
#include <iostream>
using namespace std;
int main()
{
typedef map<double,string>Map;
Map a;
a.insert( Map::value_type(0.1,"a") );
a.insert( Map::value_type(0.2,"b") );
a.insert( Map::value_type(0.3,"c") );
a.insert( Map::value_type(0.4,"d") );
iterator_traits<Map::iterator>::difference_type dist=distance(a.begin(),a.find(0.3) );
cout<<dist<<endl;
return 0;
}