---
title: Operator操作符重载接口
description: "重载状态信息对象操作符“==”。实现将判断两个状态对象是否相等的逻辑，重载为只判断两个状态对象的错误码是否相等。"
url: https://www.hiascend.com/document/detail/zh/mindie/latest/mindiellm/llmdev/mindie_llm0140.html
sourcePath: /source/zh/mindie/310/mindiellm/llmdev/mindie_llm0140.html
indexId: e8e4821e414505afdfddcac82bb14d5fac6303a43d6066ba91406ee5947c3a9058
---
# Operator操作符重载接口

#### 接口功能

重载状态信息对象操作符“==”。实现将判断两个状态对象是否相等的逻辑，重载为只判断两个状态对象的错误码是否相等。


#### 接口格式

```
bool operator==(const Status& other) const;
```


#### 接口参数

| 参数 | 是否必选 | 说明 | 取值要求 |
| --- | --- | --- | --- |
| other | 必选 | 与本状态对象比较的另外一个状态对象。 | Status类，状态对象。 |


#### 使用样例

创建一个Status对象，然后调用==操作符。

```
auto status1 = Status(Error::Code::ERROR, "Engine init model failed: new modelBackend failed");
auto status2 = Status(Error::Code::ERROR, "Engine init model failed: new modelBackend failed");
bool isEqual = status1 == status2 ;
```


#### 返回值

- true：相等。
- false：不相等。
