prg_vector_find_equivalent()

摘要

在 vector 中查找一个等价的元素。

语法

prg_vector_find_equivalent (vector_ptr, client_state_ptr, equiv_proc, found_ptr)
参数 类型 说明
vector_ptr PrgT_Vector * 目标 vector。
client_state_ptr const void * 要查找的元素。
equiv_proc PrgT_Vector_Element_Equiv_Proc 判断两个元素是否等价的函数。
found_ptr int * 若找到匹配元素则置为 PRGC_TRUE,否则置为 PRGC_FALSE。

返回类型

unsigned long

匹配元素的零基位置索引。仅当 found_ptr 被置为 PRGC_TRUE 时该返回值才有意义。

头文件

prg_vector.h

详情

遍历 vector 中的元素,使用 equiv_proc 判断是否找到匹配项。若找到匹配元素,则返回其在 vector 中的位置索引。若该过程未找到元素,则返回一个无意义的值。因此,在使用返回值之前,应始终检查 found_ptr 的值。

equiv_proc 的函数原型见 PrgT_Vector_Element_Equiv_Proc。

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com