博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
functor
阅读量:4587 次
发布时间:2019-06-09

本文共 586 字,大约阅读时间需要 1 分钟。

I thought it would be easy and convenient to define a small functor and perform a customized sort on some objects I have. However, I can't seem to get the functor to work. Here is some code that gives me a "no matching call" error:

class Cmp{    bool operator()(int x, int y) const { return x < y; } }; vector
vec; std::sort(vec.begin(), vec.end(), Cmp() );

As far as I can tell I followed the requirements exactly, but apparently I didn't. Can anyone tell me what is wrong with the above code? Thanks for your time.

转载于:https://www.cnblogs.com/zhoug2020/p/4913694.html

你可能感兴趣的文章
1052 Linked List Sorting (25 分)
查看>>
js 滚动到指定位置(带step 速度)
查看>>
项目初尝试——α迭代感想
查看>>
dgraph实现基本操作
查看>>
[Arduino] 基于Xbee Pro和网络技术的智能公交系统设计
查看>>
My97DatePicker日历控件配置
查看>>
HDU 3586-Information Disturbing(树形dp)
查看>>
《超越CSS:web设计精髓》的读后感
查看>>
团队项目第一阶段冲刺站立会议09
查看>>
团队项目第二阶段冲刺站立会议03
查看>>
Python 错误和异常小结
查看>>
sass基础
查看>>
转载:关于加班和效率
查看>>
1186: 零起点学算法93——改革春风吹满地
查看>>
关于Unity中特殊目录
查看>>
360wifi提取版
查看>>
关于Unity遇到的问题
查看>>
jQuery---ajax
查看>>
用TypeScipt和AMD模块化理念实现React官方教程(五)提交和更新数据
查看>>
5.错误处理和脚本调试
查看>>