NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
计数算法

统计元素数量的算法 更多...

计数算法 的协作图:

函数

template<typename Iterator, typename T, typename BinaryPredicate, enable_if_t< is_ranges_input_iter_v< Iterator >, int > = 0>
constexpr iter_difference_t< Iterator > neforce::count_if (Iterator first, Iterator last, const T &value, BinaryPredicate pred)
 统计范围内满足二元谓词的元素数量
template<typename Iterator, typename Predicate>
constexpr iter_difference_t< Iterator > neforce::count_if (Iterator first, Iterator last, Predicate pred)
 统计范围内满足谓词的元素数量
template<typename Iterator, typename T>
constexpr iter_difference_t< Iterator > neforce::count (Iterator first, Iterator last, const T &value)
 统计范围内等于指定值的元素数量

详细描述

统计元素数量的算法

函数说明

◆ count()

template<typename Iterator, typename T>
iter_difference_t< Iterator > neforce::count ( Iterator first,
Iterator last,
const T & value )
constexpr

统计范围内等于指定值的元素数量

模板参数
Iterator迭代器类型,需要满足输入迭代器要求
T值类型
参数
first范围的起始迭代器
last范围的终止迭代器
value要统计的值
返回
等于value的元素数量

在文件 search.hpp391 行定义.

引用了 count() , 以及 count_if().

被这些函数引用 neforce::base_char_traits< CharT, IntT >::assign(), neforce::deque< T, Alloc, BufSize >::assign(), neforce::barrier< CmplFunc >::barrier(), neforce::base_char_traits< CharT, IntT >::compare(), neforce::base_char_traits< CharT, IntT >::copy(), copy_n(), count(), neforce::simd::count_byte(), neforce::base_char_traits< CharT, IntT >::find(), FNV_hash(), neforce::sql_builder::limit(), memory_compare(), memory_copy(), memory_copy_offset(), memory_copy_until(), memory_find(), memory_move(), memory_set(), memory_zero(), neforce::base_char_traits< CharT, IntT >::move(), neforce::sql_builder::offset(), operator%(), operator%(), operator*(), operator+(), operator-(), operator/(), neforce::hazard_pointer_domain::retire(), search_n(), search_n(), neforce::http::byte_cursor::skip(), string_compare(), string_compare_ignore_case(), string_concatenate(), string_copy(), string_copy_offset(), string_find(), string_set(), neforce::tree_barrier< CmplFunc >::tree_barrier(), neforce::http::byte_cursor::try_read_bytes(), uninitialized_copy_n(), uninitialized_move_n(), neforce::vector< Value, Alloc >::view(), neforce::vector< Value, Alloc >::view() , 以及 neforce::task_group::wait().

◆ count_if() [1/2]

template<typename Iterator, typename T, typename BinaryPredicate, enable_if_t< is_ranges_input_iter_v< Iterator >, int > = 0>
iter_difference_t< Iterator > neforce::count_if ( Iterator first,
Iterator last,
const T & value,
BinaryPredicate pred )
constexpr

统计范围内满足二元谓词的元素数量

模板参数
Iterator迭代器类型,需要满足输入迭代器要求
T值类型
BinaryPredicate二元谓词函数类型
参数
first范围的起始迭代器
last范围的终止迭代器
value比较值
pred二元谓词函数
返回
满足谓词的元素数量

在文件 search.hpp349 行定义.

引用了 count_if().

被这些函数引用 count(), count_if() , 以及 count_if().

◆ count_if() [2/2]

template<typename Iterator, typename Predicate>
iter_difference_t< Iterator > neforce::count_if ( Iterator first,
Iterator last,
Predicate pred )
constexpr

统计范围内满足谓词的元素数量

模板参数
Iterator迭代器类型,需要满足输入迭代器要求
Predicate谓词函数类型
参数
first范围的起始迭代器
last范围的终止迭代器
pred谓词函数
返回
满足谓词的元素数量

在文件 search.hpp369 行定义.

引用了 count_if() , 以及 is_ranges_input_iter_v.