STL map+vector+struct的使用示例
2024-09-14 06:09:00
个人编写的小例子,没有注释,刚毕业时作为技术调研随手编写,仅供参考:
#include<iostream>
#include<map>
#include<vector> using namespace std; struct date_s
{
long id;
string obj_type;
string obj_name;
};
typedef vector<date_s> S_vector;
int main(int argc,char ** argv)
{
int table_no;
vector<date_s> v_data;
map<int,S_vector> m;
map<int,S_vector>::iterator it_m; date_s d1,d2,d3;
d1.id = ;
d1.obj_name = "lijin";
d1.obj_type = "man"; d2.id = ;
d2.obj_name = "duanxiang";
d2.obj_type = "man"; d3.id = ;
d3.obj_name = "yuandong";
d3.obj_type = "man"; v_data.push_back(d1);
v_data.push_back(d2);
v_data.push_back(d3);
m[] = v_data;
S_vector tmp; it_m = m.begin();
tmp = it_m->second; cout<<it_m->second.front().id<<endl; for(;it_m != m.end();it_m++)
{
// cout<<it_m->first<<":"<<it_m->second.id<<" "<<it_m->second.obj_name<<endl; } return ;
}
最新文章
- SharePoint Online 申请试用链接地址
- java web开发小细节
- 基础调试命令 - wt (watch and trace)
- php面向对象常见的专业术语
- Outer Join Query Over Dblink Can Fail With ORA-904 (Doc ID 730256.1)
- pku 1182(种类并查集)
- zabbix接口调用注意事项--Python
- WPF之鼠标滑动切换图片
- (3/18)重学Standford_iOS7开发_Objective-C_课程笔记
- 全栈project师?给把瑞士军刀你去砍鬼子好不好!?
- Linux根目录详解-转自鸟哥的私房菜
- 【leetcode78】Single Number II
- configparser模块--配置文件
- linux cron计划任务、chkconfig 命令、systemd命令、unit 相关、target 相关
- windows下通过VNC图形化访问Ubuntu桌面环境
- 由Windows开发平台向Linux平台转移的一些想法
- Linux操作系统(二)
- Qt Multimedia Backends(多媒体后端)翻译
- 字符串数组是可以保存并输出null。只不过不好动态指定长度
- 移植MonkeyRunner的图片对照和获取子图功能的实现-UiAutomator/Robotium篇