c++ - 标称数据上的 C++ std::set_operations(set_difference、set_intersection 等)
问题描述
集合被分类为无序的唯一数据容器。因此,集合操作应该适用于标称数据(例如颜色)。但不知何故,像 set_difference 和 set_intersection 这样的 std::set_operations 和自定义比较函数只适用于序数数据(有序数据,如 int)。有任何想法吗?
auto comp = [](const int a, const int b) -> bool {
return a == b; // not working
return a != b; // not working
return a < b; // works as expected
}
解决方案
推荐阅读
- akka.net - Akka - 无法在 F# 中将有区别的联合作为消息发送
- firebase - QML Firebase startAt 返回未定义
- c# - 如何在创建 Concreate 子类的抽象类中实现静态方法
- mysql - 使用Entity Framework和MySql生成数据库时如何制作Camel案例表名
- python - Pandas DataFrame:计算一列中与第二列内容相同的那些行的平均值?
- python - 如何正确显示使用 SELENIUM 和 PYTHON 加载网站所需的时间
- amazon-web-services - 远程桌面连接到 ec2 实例
- python - sqlalchemy:如何使用附加列更新多对多关系表
- sql - 检查特定日期是否在两个日期之间使用 between 给出不正确的结果
- c++11 - 在 vec.push_back 之后,为什么我可以访问超出范围的索引?