---
title: ConvertToListAscendString
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/atlasgeapi_07_0377.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/atlasgeapi_07_0377.html
indexId: 64ad82bb5e2f34274c3afe61dd4a6b16a3ffb56c998f22178d553d837107247972
---
# ConvertToListAscendString

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |


#### 头文件

#include <graph/operator_reg.h>


#### 功能说明

定义了一个模板函数ConvertToListAscendString，用于将不同类型的字符串列表转换为AscendString类型的列表。


#### 函数原型

```
template<typename T> std::vector<ge::AscendString> ConvertToListAscendString(T strs)
```


支持以下两种拓展：

- template<> inline std::vector<ge::AscendString> ConvertToListAscendString(std::vector<std::string> strs)
  对于std::vectorstd::string类型的字符串列表，先将其转换为std::vector<const char *>类型，然后再进行转换。

- template<> inline std::vector<ge::AscendString> ConvertToListAscendString(std::vector<ge::AscendString> strs)
  对于std::vector<ge::AscendString>类型的字符串列表，直接返回原列表。


#### 参数说明

| 参数 | 输入/输出 | 说明 |
| --- | --- | --- |
| strs | 输入 | 待转换的字符串列表。 |


#### 返回值说明

转换后的AscendString类型字符串列表。


#### 约束说明

无。
