# std::coroutine_handle<Promise>::operator=

> C++ Atlas: `cppatlas.com/w/cpp/coroutine/coroutine_handle/operator=` | Source: https://en.cppreference.com/w/cpp/coroutine/coroutine_handle/operator= | Domain: Coroutine support | Standards: C++20

Replaces the underlying address.

## Official Specification Summary (cppreference)

```cpp
coroutine_handle& operator=( std::nullptr_t ) noexcept; // (1) (since C++20)
coroutine_handle& operator=( const coroutine_handle& other ) = default; // (2) (since C++20)
coroutine_handle& operator=( coroutine_handle&& other ) = default; // (3) (since C++20)
```

Replaces the underlying address.

1) Replaces the underlying address with a null pointer value. After assignment, `*this` does not refer to a coroutine. This assignment operator is not declared for specialization `std::coroutine_handle<std::noop_coroutine_promise>`.

2,3) Replaces the underlying address with the one of `other`. Copy and move assignment operators are equivalent to implicitly declared ones.

### Parameters

- `other` - another `coroutine_handle` to assign from

### Return value

`*this`

---
Attribution: content from https://en.cppreference.com/w/cpp/coroutine/coroutine_handle/operator= (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.