|
MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
在有序范围内查找边界的二分查找算法 更多...
函数 | |
| template<typename Iterator, typename T, typename Compare, enable_if_t< is_ranges_fwd_iter_v< Iterator >, int > = 0> | |
| constexpr Iterator | lower_bound (Iterator first, Iterator last, const T &value, Compare comp) |
| 查找有序范围中第一个不小于指定值的元素位置 | |
| template<typename Iterator, typename T> | |
| constexpr Iterator | lower_bound (Iterator first, Iterator last, const T &value) |
| lower_bound的默认比较版本 | |
| template<typename Iterator, typename T, typename Compare, enable_if_t< is_ranges_fwd_iter_v< Iterator >, int > = 0> | |
| constexpr Iterator | upper_bound (Iterator first, Iterator last, const T &value, Compare comp) |
| 查找有序范围中第一个大于指定值的元素位置 | |
| template<typename Iterator, typename T> | |
| constexpr Iterator | upper_bound (Iterator first, Iterator last, const T &value) |
| upper_bound的默认比较版本 | |
| template<typename Iterator, typename T, enable_if_t< is_ranges_fwd_iter_v< Iterator >, int > = 0> | |
| constexpr bool | binary_search (Iterator first, Iterator last, const T &value) |
| 在有序范围内进行二分查找 | |
| template<typename Iterator, typename T, typename Compare, enable_if_t< is_ranges_fwd_iter_v< Iterator >, int > = 0> | |
| constexpr bool | binary_search (Iterator first, Iterator last, const T &value, Compare comp) |
| binary_search的谓词版本 | |
| template<typename Iterator1, typename Iterator2, typename Compare, enable_if_t< is_ranges_input_iter_v< Iterator1 > &&is_ranges_input_iter_v< Iterator2 >, int > = 0> | |
| constexpr bool | includes (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2, Compare comp) |
| 检查一个有序范围是否包含另一个有序范围的所有元素 | |
| template<typename Iterator1, typename Iterator2> | |
| constexpr bool | includes (Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) |
| includes的默认比较版本 | |
在有序范围内查找边界的二分查找算法
|
constexpr |
在有序范围内进行二分查找
| Iterator | 迭代器类型,需要满足前向迭代器要求 |
| T | 查找值的类型 |
| first | 范围的起始迭代器 |
| last | 范围的终止迭代器 |
| value | 要查找的值 |
在文件 search.hpp 第 132 行定义.
引用了 _MSTL , 以及 lower_bound().
|
constexpr |
binary_search的谓词版本
| Iterator | 迭代器类型,需要满足前向迭代器要求 |
| T | 查找值的类型 |
| Compare | 比较函数类型 |
| first | 范围的起始迭代器 |
| last | 范围的终止迭代器 |
| value | 要查找的值 |
| comp | 比较函数 |
在文件 search.hpp 第 149 行定义.
引用了 _MSTL , 以及 lower_bound().
|
constexpr |
includes的默认比较版本
| Iterator1 | 主序列迭代器类型 |
| Iterator2 | 子序列迭代器类型 |
| first1 | 主序列起始迭代器 |
| last1 | 主序列终止迭代器 |
| first2 | 子序列起始迭代器 |
| last2 | 子序列终止迭代器 |
在文件 search.hpp 第 189 行定义.
引用了 _MSTL , 以及 includes().
|
constexpr |
检查一个有序范围是否包含另一个有序范围的所有元素
| Iterator1 | 主序列迭代器类型,需要满足输入迭代器要求 |
| Iterator2 | 子序列迭代器类型,需要满足输入迭代器要求 |
| Compare | 比较函数类型 |
| first1 | 主序列起始迭代器 |
| last1 | 主序列终止迭代器 |
| first2 | 子序列起始迭代器 |
| last2 | 子序列终止迭代器 |
| comp | 比较函数 |
在文件 search.hpp 第 168 行定义.
被这些函数引用 includes().
|
constexpr |
lower_bound的默认比较版本
| Iterator | 迭代器类型 |
| T | 查找值的类型 |
| first | 范围的起始迭代器 |
| last | 范围的终止迭代器 |
| value | 要查找的值 |
使用默认的less比较器执行lower_bound查找。
在文件 search.hpp 第 68 行定义.
引用了 _MSTL , 以及 lower_bound().
|
constexpr |
查找有序范围中第一个不小于指定值的元素位置
| Iterator | 迭代器类型,需要满足前向迭代器要求 |
| T | 查找值的类型 |
| Compare | 比较函数对象类型 |
| first | 范围的起始迭代器 |
| last | 范围的终止迭代器 |
| value | 要查找的值 |
| comp | 比较函数对象 |
在有序范围[first, last)中执行二分查找,返回第一个满足!comp(*it, value)的 元素位置。要求范围已按照comp排序。
在文件 search.hpp 第 37 行定义.
引用了 _MSTL, advance() , 以及 distance().
被这些函数引用 binary_search(), binary_search(), equal_range() , 以及 lower_bound().
|
constexpr |
upper_bound的默认比较版本
| Iterator | 迭代器类型 |
| T | 查找值的类型 |
| first | 范围的起始迭代器 |
| last | 范围的终止迭代器 |
| value | 要查找的值 |
使用默认的greater比较器执行upper_bound查找。
在文件 search.hpp 第 118 行定义.
引用了 _MSTL , 以及 upper_bound().
|
constexpr |
查找有序范围中第一个大于指定值的元素位置
| Iterator | 迭代器类型,需要满足前向迭代器要求 |
| T | 查找值的类型 |
| Compare | 比较函数对象类型 |
| first | 范围的起始迭代器 |
| last | 范围的终止迭代器 |
| value | 要查找的值 |
| comp | 比较函数对象 |
在有序范围[first, last)中执行二分查找,返回第一个满足comp(value, *it)的 元素位置。要求范围已按照comp排序。
在文件 search.hpp 第 87 行定义.
引用了 _MSTL, advance() , 以及 distance().
被这些函数引用 equal_range() , 以及 upper_bound().