prg_vector_insert()

Abstract

Introduces an element into a vector and, if necessary, shifts all higher-indexed elements to create space.

Syntax

prg_vector_insert (vector_ptr, element_ptr, pos_index)
Argument Type Description
vector_ptr PrgT_Vector * vector of interest
element_ptr void * element to be introduced into the vector
pos_index unsigned long position of the element in the vector (zero-indexed). Can be numeric or one of the symbolic constants described in Details.

Return Type

PrgT_Compcode

Indicates success/failure. Failure only occurs due to insufficient memory resources.

prg_vector.h

Details

As opposed to prg_vector_set(), which replaces elements, this function creates space by shifting elements toward higher positions in the vector. The element is then introduced into the specified position. If necessary, the shifting may cause the vector's memory resources to expand.

Position indices are zero-indexed. In other words, the first element has position index 0, the second is 1, and so on.

In addition to an explicit numeric value, pos_index can be specified as one of the following symbolic constants:

  • PRGC_VECTOR_INSERT_POS_HEAD—inserts the element at the first (0th) position of the vector
  • PRGC_VECTOR_INSERT_POS_TAIL—inserts the element at the end (highest) position of the vector

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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