#include "stdafx.h"
#include <string>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <boost/multi_index/ordered_index.hpp>
using namespace std;
using namespace boost;
/*
定义一个MutiStruct
key : 1. objectID
2. strName value: 对象指针STNodePtr
*/
struct MutiStruct
{
int   objectID;//唯一
string strName;//唯一 STNodePtr ptrNode;//设备对象指针
}; /*
定义容器,索引
*/
using MutiContainer = boost::multi_index::multi_index_container <
MutiStruct,
boost::multi_index::indexed_by <
boost::multi_index::ordered_unique<boost::multi_index::member<MutiStruct, int, &MutiStruct::objectID>>,
boost::multi_index::ordered_unique<boost::multi_index::member<MutiStruct, string, &MutiStruct::strName>>
>
>; /*
有多少个key,就定义多少个枚举,
0:表示以第一个索引作为key。
1:表示以第二个索引作为key。
*/
enum
{
KEY_1_VIEW = ,
KEY_2_VIEW =
};
using MI_OBJ_IDX = MutiContainer::nth_index<KEY_1_VIEW>::type;
using MI_NAME_IDX = MutiContainer::nth_index<KEY_2_VIEW>::type;
/*插入数据到容器*/
MutiContainer Conter; MutiStruct mi;
mi.objectID = ;
mi.strName = "nihao"; std::pair<MutiContainer::iterator, bool> p = Conter.insert(mi);
if (!p.second)
{
printf("insert fail \n");
}

最新文章

  1. C语言之链表
  2. arcgis地图数据集合
  3. 移动混合开发之android文件管理--&gt;flexbox,webFont。
  4. FZU 2193 So Hard (有限小数转换最简分数)(想法题)
  5. 分享Kali Linux 2016.2第49周虚拟机
  6. mysql5.6 TIME,DATETIME,TIMESTAMP
  7. java软件包的访问权限和继承
  8. WPF DataGrid 行头小三角
  9. UI编辑器
  10. linux 下创建管理员权限账户
  11. Windows窗口的尺寸和位置
  12. linux个人情况总结
  13. 关于web页面JApplet打印小票
  14. [LeetCode] Bus Routes 公交线路
  15. Zabbix通过Orabbix监控Oracle数据库
  16. 论文笔记:Batch Normalization
  17. java web filter读取classpath配置文件内容
  18. iOS.Info.plist
  19. mac10.12.6系统配置clion编写CMakeLists文件运行opencv3
  20. Codeforces Round #353 (Div. 2) A. Infinite Sequence 水题

热门文章

  1. 怎么在本地建立一个Maven 项目push到码云(https://git.oschina.net)
  2. DirectX12 3D 游戏开发与实战第四章内容(下)
  3. aclocal-1.14: 未找到命令
  4. JavaScript之深入函数(一)
  5. Linux系统在开机的时候自动启动SVN
  6. 数据分析--numpy的基本使用
  7. myql忽略大小写问题解决
  8. 【SQL server初级】数据库性能优化二:数据库表优化
  9. Kubernetes 系列(二):Deployment 扩容
  10. 使用 .NET Core 3.0 的 AssemblyLoadContext 实现插件热加载