当前位置:网站首页>Qt Notes - qmap Custom key
Qt Notes - qmap Custom key
2022-06-22 16:58:00 【It1995】
Comme suitkeyValeur:
struct MyKey{
MyKey(QString key1, int key2){
this->key1 = key1;
this->key2 = key2;
}
QString key1;
int key2;
};PersonnalisationkeyLes problèmes suivants se posent:

Le symbole d'action gauche doit être dépassé,Comme suit:
struct MyKey{
MyKey(QString key1, int key2){
this->key1 = key1;
this->key2 = key2;
}
bool operator < (const MyKey &key) const{
return std::tie(key1, key2) < std::tie(key.key1, key.key2);
}
QString key1;
int key2;
};Toutes les sources sont les suivantes::
#include <QCoreApplication>
#include <QMap>
#include <QDebug>
struct MyKey{
MyKey(QString key1, int key2){
this->key1 = key1;
this->key2 = key2;
}
bool operator < (const MyKey &key) const{
return std::tie(key1, key2) < std::tie(key.key1, key.key2);
}
QString key1;
int key2;
};
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QMap<MyKey, QString> map;
map.insert(MyKey("10086", 0), "value1");
map.insert(MyKey("10086", 1), "value2");
map.insert(MyKey("10086", 2), "value3");
map.insert(MyKey("10010", 1), "value4");
map.insert(MyKey("10010", 2), "value5");
return a.exec();
}
Voici une capture d'écran de débogage:

Code source package download address:
边栏推荐
- Source code analysis of spark cache
- ERROR 1364 (HY000): Field ssl_cipher doesnt have a default value
- 【心理学】情感心理学-当代思想和传统思想的碰撞(本篇文章将不定期持续更新)
- Spark Streaming-Receiver启动和数据接收
- Test for API
- spark关于数据倾斜问题
- [C language] deeply analyze the storage of integer and floating-point types in memory
- 【微信小程序封装底部弹出框二】
- Gridhome, a must-have static site generator for beginners
- 数据库mysql 主从方案
猜你喜欢

高可用性的ResourceManager

Special research on Intelligent upgrading of heavy trucks in China in 2022

【微信小程序封装底部弹出框】一

mysql5.7.27安装之windows8.1 64

In the era of video explosion, who is supporting the high-speed operation of video ecological network?

jsp学习之(三)--------- jsp隐式对象
![[pop up box 2 at the bottom of wechat applet package]](/img/31/266e6a1f4200347c9324ea37b78562.png)
[pop up box 2 at the bottom of wechat applet package]

What is restful and what rules should be followed when designing rest APIs?

2022年中国重卡智能化升级专题研究

系统吞吐量、TPS(QPS)、用户并发量、性能测试概念和公式
随机推荐
每秒处理10万高并发订单的乐视集团支付系统架构分享
Add a millennial sign to a number (amount in millennia)
JMeter use case
VHEDT业务发展框架
Summary of JS methods for obtaining data types
团队管理|如何提高技术 Leader 的思考技巧?
Interface (optimization type annotation)
spark-shuffle的读数据源码分析
【游标的嵌套】mysql存储过程游标的嵌套
企业级软件开发新模式:低代码
Huawei cloud recruits partners in the field of industrial intelligence to provide strong support + commercial realization
The way to optimize spark performance -- solving N poses of spark data skew
Vs2017 solution to not displaying qstring value in debugging status
Test for API
[C language] deeply analyze the relationship between pointer and array
调用cmd 进程通信
Special research on Intelligent upgrading of heavy trucks in China in 2022
spark-cache的源码分析
JS获取数据类型方法总结
MYSQL_ERRNO : 1205 MESSAGE :Lock wait timeout exceeded; try restarting transacti
https://github.com/fengfanchen/Qt/tree/master/QMapKeyCustom