---
title: insert
description: "向SVector内指定位置插入元素。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendtb/ascendtb_01_0026.html
sourcePath: /source/zh/canncommercial/900/API/ascendtb/ascendtb_01_0026.html
indexId: 5e1e403c52b21c5b295763f02b8692cf7be9470bd02e387bba90f094d873201464
---
# insert

#### 功能说明

向SVector内指定位置插入元素。


#### 定义

```
void insert(const std::size_t pos, const T &value) noexcept((!CHECK_BOUND) && std::is_nothrow_assignable<T, const T &>::value)
```


#### 参数列表

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| pos | 输入 | 在pos处插入元素。 |
| value | 输入 | 插入在pos处的元素值。 |


#### 约束说明

若调用函数时，待插入元素的SVector长度大于或等于MAX_SVECTOR_SIZE，则会抛出长度溢出异常。

若传入的参数“pos”大于SVector内元素的数量，则会抛出长度溢出异常。
