Hack-jun

Forever Young!


  • 首页

  • 标签

  • 归档

  • 日程表

upper_bound

发表于 2022-05-20

使用C++的STL的二分模板时,对于自定义函数如何写非常疑惑,在这里记录一下

1
2
3
template <class ForwardIterator, class T, class Compare>
ForwardIterator lower_bound (ForwardIterator first, ForwardIterator last,
const T& val, Compare comp);

lower_bound和upper_bound的原型完全相同,不同的是自定义函数的参数顺序相反

upper_bound comp的第一个参数必须是 val,第二个是迭代器。

lower_bound comp的第一个参数必须是迭代器,第二个是val。

comp代表的语义:当comp返回TRUE时,代表第一个参数在第二参数的前面(这个关系着大小顺序)。

comp 代表的就是小于没有等于,这时候的功能才正确。(所以在自定义函数中不应该涉及等于情况)。

Link

发表于 2022-04-23

链接种类

  • 编译时 静态库,整合到可执行文件中

  • 加载时 动态库,在load时loader看到interp节,调用动态连接器

  • 运行时 由代码决定加载那个,可以实现热更新

阅读全文 »

Hello World

发表于 2022-04-23

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

3 日志
2 标签
© 2022 yiwei
由 Hexo 强力驱动
|
主题 — NexT.Muse v5.1.4
0%