本博客http://blog.csdn.net/livelylittlefish 贴 出作 者(三二一@小鱼)相关研究、学习内容所做的笔记,欢迎广大朋友指正!
1. 引子
在“ Boost 组件 multi_index_container 实例 (1) ”的基础上,解决 find 不成功的问题。本例只使用简单的打印和查找方法。
2. 修改 operator<
//define operator< of index for this container
bool operator<(const MyIndex& lhs, const MyIndex& rhs)
{
if (lhs.x < rhs.x) return true;
else if (lhs.x > rhs.x) return false;
else if (lhs.y < rhs.y) return true;
else if (lhs.y > rhs.y) return false;
else if (lhs.z < rhs.z) return true;
else if (lhs.z > rhs.z) return false;
else return false;
}
将元组 r=(x,y,z,a,b) 插入