System::Collections::Generic::_net_binnary_search 方法

System::Collections::Generic::_net_binnary_search(const containterT<T, Allocator>&, int, int, T) method

实现对随机访问容器的二分搜索。针对智能指针的特化。使用 System::Object::CompareTo 方法。

template<template< typename, typename > class,class T,class Allocator> std::enable_if<IsSmartPtr<T>::value, int>::type System::Collections::Generic::_net_binnary_search(const containterT<T, Allocator> &container, int index, int count, T value)
参数描述
containerTSTL 风格的容器模板类型,具有两个模板参数:元素类型和分配器类型。
T元素类型。
Allocator分配器类型。
参数类型描述
容器const containterT<T, Allocator>&要搜索的容器。
索引int搜索范围的起始索引。
countint搜索范围的长度。
T要查找的值。

ReturnValue

如果找到,则返回下一个元素的索引;否则,返回搜索停止时索引的补数。

另见

System::Collections::Generic::_net_binnary_search(const containterT<T, Allocator>&, int, int, T) method

实现对随机访问容器的二分搜索。针对值类型的特化。使用 CompareTo 方法。

template<template< typename, typename > class,class T,class Allocator> std::enable_if<!IsSmartPtr<T>::value &&!std::is_scalar<T>::value, int>::type System::Collections::Generic::_net_binnary_search(const containterT<T, Allocator> &container, int index, int count, T value)
参数描述
containerTSTL 风格的容器模板类型,具有两个模板参数:元素类型和分配器类型。
T元素类型。
Allocator分配器类型。
参数类型描述
容器const containterT<T, Allocator>&要搜索的容器。
索引int搜索范围的起始索引。
countint搜索范围的长度。
T要查找的值。

ReturnValue

如果找到,则返回下一个元素的索引;否则,返回搜索停止时索引的补数。

另见

System::Collections::Generic::_net_binnary_search(const containterT<T, Allocator>&, int, int, T) method

实现对随机访问容器的二分搜索。针对标量类型的特化。使用大于和小于运算符比较元素。

template<template< typename, typename > class,class T,class Allocator> std::enable_if<std::is_scalar<T>::value, int>::type System::Collections::Generic::_net_binnary_search(const containterT<T, Allocator> &container, int index, int count, T value)
参数描述
containerTSTL 风格的容器模板类型,具有两个模板参数:元素类型和分配器类型。
T元素类型。
Allocator分配器类型。
参数类型描述
容器const containterT<T, Allocator>&要搜索的容器。
索引int搜索范围的起始索引。
countint搜索范围的长度。
T要查找的值。

ReturnValue

如果找到,则返回下一个元素的索引;否则,返回搜索停止时索引的补数。

另见

System::Collections::Generic::_net_binnary_search(const containterT<T, Allocator>&, int, int, T, const SharedPtr<System::Collections::Generic::IComparer<T>>&) method

实现对随机访问容器的二分搜索。

template<template< typename, typename > class,class T,class Allocator> int System::Collections::Generic::_net_binnary_search(const containterT<T, Allocator> &container, int index, int count, T value, const SharedPtr<System::Collections::Generic::IComparer<T>> &comparer)
参数描述
containerTSTL 风格的容器模板类型,具有两个模板参数:元素类型和分配器类型。
T元素类型。
Allocator分配器类型。
参数类型描述
容器const containterT<T, Allocator>&要搜索的容器。
索引int搜索范围的起始索引。
countint搜索范围的长度。
T要查找的值。
comparerconst SharedPtr<System::Collections::Generic::IComparer<T>>&Comparer 对象。

ReturnValue

如果找到,则返回下一个元素的索引;否则,返回搜索停止时索引的补数。

另见