- 浏览: 718887 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (1042)
- 数据结构 (36)
- UML与设计模式 (42)
- c++ (87)
- rust (36)
- Qt (41)
- boost模板元编程 (43)
- Linux (77)
- 汇编 (4)
- 其它 (2)
- 烹饪 (3)
- unix c / socket (73)
- 软件工程 (4)
- shell (52)
- Python (37)
- c++ primer 5th(c++11) (22)
- 数据库/MySQL (27)
- 数据存储 (4)
- lisp (7)
- git (4)
- Utility (3)
- CDN与DNS (54)
- Http (53)
- php (7)
- nginx/lua/openresty (41)
- redis (11)
- TCP/IP (16)
- 互联网 (6)
- kernel (2)
- go (33)
- 区块链 (43)
- 比特股 (13)
- 以太坊 (23)
- 比特币 (23)
- 密码学 (10)
- EOS (53)
- DAG (1)
- docker (1)
- filecoin (7)
- solidity (64)
- ipfs (8)
- 零知识证明 (1)
- openzeppelin (3)
- java (1)
- defi (7)
最新评论
根据不同的类中不同的字段排序
account_object.hpp 320,371
#include <boost/multi_index_container.hpp> #include <boost/multi_index/member.hpp> #include <boost/multi_index/ordered_index.hpp> #include <iostream> #include <string.h> using namespace boost; using namespace std; struct Student { Student(int i,string n,int a) { id = i; name = n; age = a; } friend std::ostream& operator<<(std::ostream& os,const Student& a) { os << "id:" << a.id << ",name:" << a.name << ",age:"<<a.age << std::endl; return os; } int id; string name; int age; }; typedef boost::multi_index_container<Student,boost::multi_index::indexed_by< boost::multi_index::ordered_unique<boost::multi_index::member<Student,int,&Student::id>>,//id唯一 boost::multi_index::ordered_unique<boost::multi_index::member<Student,string,&Student::name>>, boost::multi_index::ordered_non_unique<boost::multi_index::member<Student,int,&Student::age>>//age允许不唯一 > > StudentContainer; typedef StudentContainer::nth_index<0>::type IdIndex; typedef StudentContainer::nth_index<1>::type NameIndex; typedef StudentContainer::nth_index<2>::type AgeIndex; int main() { StudentContainer sc; sc.insert(Student(1,"zhangsan",20)); sc.insert(Student(3,"lisi",22)); sc.insert(Student(2,"wangwu",21)); sc.insert(Student(4,"zhaoliu",22)); IdIndex& sortById = sc.get<0>(); NameIndex& sortByName = sc.get<1>(); AgeIndex& sortByAge = sc.get<2>(); cout << "sort by id:" << endl; copy(sortById.begin(),sortById.end(), ostream_iterator<Student>(cout)); cout << "sort by name:" << endl; copy(sortByName.begin(),sortByName.end(), ostream_iterator<Student>(cout)); cout << "sort by age:" << endl; copy(sortByAge.begin(),sortByAge.end(), ostream_iterator<Student>(cout)); } sort by id: id:1,name:zhangsan,age:20 id:2,name:wangwu,age:21 id:3,name:lisi,age:22 id:4,name:zhaoliu,age:22 sort by name: id:3,name:lisi,age:22 id:2,name:wangwu,age:21 id:1,name:zhangsan,age:20 id:4,name:zhaoliu,age:22 sort by age: id:1,name:zhangsan,age:20 id:2,name:wangwu,age:21 id:3,name:lisi,age:22 id:4,name:zhaoliu,age:22
account_object.hpp 320,371
发表评论
-
爆仓单的正确吃法
2018-10-24 09:00 378论吃爆仓单的正确姿势: 平仓卖单出现条件:喂价<强平触 ... -
常用术语
2018-10-24 08:59 306call limit:强平触发价 settlement pri ... -
RPC
2018-09-27 07:37 326curl --data '{"jsonrpc&quo ... -
BTS金融
2018-09-02 10:05 5491.所有发行人需要做的是发布资产的有效global_settl ... -
资产创建费用
2018-09-02 09:43 391The asset creation fee depends ... -
手动创建交易
2018-08-25 12:00 3971.2.17是nathan,1.2.21是一个新帐户 1.创 ... -
blind-account
2018-08-25 08:11 3121.创建 unlocked >>> crea ... -
比特股ID
2018-08-12 09:02 333template<uint8_t SpaceID, ... -
比特股调试信息颜色
2018-08-10 07:26 424控制台输出: 绿色 - 调试 白色 - 信息/默认 黄色/棕色 ... -
资产费用
2018-08-09 23:02 36250%的资产创建费用用于资产的资金池,剩下50%的20%用于网 ... -
program_options读命令行和配置文件
2018-07-27 11:30 796#include <boost/program_opti ... -
BTS私链搭建
2018-07-25 10:16 891https://blog.csdn.net/ggq89/art ... -
BTS基础
2018-07-24 07:37 387https://bitsharestalk.org/index ... -
centos下boost安装
2014-03-27 09:28 1010./booststarp.sh //这里的一些错误不用管 ... -
GC的改良
2013-10-17 22:05 529分代回收:对分配不久,诞生时间较短的“年龄”对象进行重点扫描, ... -
GC与引用记数
2013-10-16 21:57 664根(Root)就是判断对象是否可被引用的起始点。至于哪里才是根 ... -
boost 信号槽
2011-06-08 23:43 2273#include<boost/signals2.hp ... -
boost bind
2011-06-07 15:28 1643bind并不是一个单独的类或函数,而是非常庞大的家族,依据绑定 ... -
boost reference_wrapper
2011-06-05 21:07 1526reference_wrapper是一个引用类型的包装器 ... -
元编程
2011-06-02 22:46 893元编程的最大特点在于:某些用户自定义的计算可以在程序翻译期进行 ...
相关推荐
BOOST multi_index_container Performance test condition: 1. Giving a sentence around 100 bytes (English & Chinese mixed) 2. Dirty phrases around 10,000 3. Do 1,000 loop test 4. Intel I7 ...
首先从您的发行版本的存储库或其他来源安装针对capnproto (version 0.7.0 or newer) , rapidjson , sqlite和boost (仅用于标头的multi_index_container库)的开发包。 在Debian Buster上,可以这样操作: sudo ...
io state savers, iostreams, iterators, minmax, mpl, multi_array, multi_index, numeric/conversion, operators, optional, pointer container, pool, preprocessor, program_options, property map, property_...
Asio, Chrono, Container, Context, Conversion, DateTime, Flyweight, Function, Functional/Factory, Fusion, Geometry, Hash, Interprocess, Intrusive, Lexical Cast, Log, Math, Move, Multi-index Containers...
Updated Libraries: Any, Asio, Circular Buffer, Config, Container, Coroutine, Flyweight, Geometry, Interprocess, Intrusive, Iterator, Lexical Cast, Math, Move, MultiArray, Multiprecision, Multi-Index ...
* Position index of the first page currently being * displayed. Page position+1 will be visible if * positionOffset is nonzero. * @param positionOffset * Value from [0, 1) indicating ...
13.4 Boost.MultiIndex 13.5 Boost.Bimap 13.6 Exercises Chapter 14: Data Structures 14.1 General 14.2 Boost.Tuple 14.3 Boost.Any 14.4 Boost.Variant 14.5 Exercises Chapter 15: Error Handling 15.1 General...
要实现下图的效果(自定义多选单选),大多数公司项目的多选框都是自己设计的,所以用原生标签或者组件是不可行的,最简单的是自己绑定事件,然后切换选择和未选择的图片。... /**利用数组的下标index来进行判
index modules | next | Python » 3.6.5 Documentation » Python Documentation contents What’s New in Python What’s New In Python 3.6 Summary – Release highlights New Features PEP 498: Formatted ...
11.zip Getting the number of columns in report view 获得列表视图的列数(2KB)<END><br>3,12.zip 添加一列 Adding a column(2KB)<END><br>4,13.zip Detecting column index of the item clicked...
4.7 Multi-threaded executions and data races . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.8 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
1.10 Multi-threaded executions and data races . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.11 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...