目录

ConvertToAscendString

Function Description

A template function. It takes a template parameter T and converts it to the AscendString type. It is mainly used to convert strings of different types to those of the AscendString type.

Function Prototype

template<typename T> ge::AscendString ConvertToAscendString(T str)

The following conversions are supported:

template<> inline ge::AscendString ConvertToAscendString<const char *>(const char *str)

Converts strings of the const char * type using the constructor function of the AscendString class.

template<> inline ge::AscendString ConvertToAscendString<std::string>(std::string str)

Converts strings of the std::string type to the const char * type first and then converts it again.

template<> inline ge::AscendString ConvertToAscendString<ge::AscendString>(ge::AscendString str)

Returns strings of the AscendString type directly.

Parameters

Parameter Input/Output Description
str Input String to be converted.

Return Value

AscendString after conversion

Exception Handling

None

Restrictions

None