Segmentation fault (core dumped)
#include <iostream>
#include <string>
//#include <UTILITY>
#include <map>
using namespace std;
struct userdevice
{
/* data */
string m_devicename;
long m_deviced;
int m_devicePopedom;
};
typedef multimap<string,userdevice> USERTABLE;
typedef USERTABLE::const_iterator CIT;
typedef pair<CIT,CIT> Range;
int main()
{
CIT it;
userdevice d1,d2,d3,d4;
d1.m_devicename="d1";
d1.m_deviced=12341234;
d1.m_devicePopedom=123;
d2.m_devicename="d2";
d2.m_deviced=23622344;
d2.m_devicePopedom=234;
d3.m_devicename="d3";
d3.m_deviced=23451234;
d3.m_devicePopedom=345;
d4.m_devicename="d4";
d4.m_deviced=43622344;
d4.m_devicePopedom=456;
USERTABLE m_user;
m_user.insert(pair<string,userdevice> ("zhangsanfeng",d1));
m_user.insert(pair<string,userdevice> ("zhangsanfeng",d2));
m_user.insert(pair<string,userdevice> ("zhangsanfeng",d3));
m_user.insert(pair<string,userdevice> ("zhangsanfeng",d4));
Range range=m_user.equal_range("zhangsanfeng");
cout<<range.first->first<<' ';
cout<<range.first->second.m_devicename<<endl;
cout<<range.second->first<<' ';
cout<<range.second->second.m_devicename<<endl;
for(CIT i=range.first;i!=range.second;i++)
{
cout<<i->second.m_deviced<<','
<<i->second.m_devicename.c_str()<<','
<<i->second.m_devicePopedom<<endl;
}
cout<<endl;
}