# std::basic_spanbuf<CharT,Traits>::operator=

> C++ Atlas: `cppatlas.com/w/cpp/io/basic_spanbuf/operator=` | Source: https://en.cppreference.com/w/cpp/io/basic_spanbuf/operator= | Domain: Input/output | Standards: C++23

May throw implementation-defined exceptions.

## Official Specification Summary (cppreference)

```cpp
basic_spanbuf& operator=( basic_spanbuf&& rhs ); // (1) (since C++23)
basic_spanbuf& operator( const basic_spanbuf& ) = delete; // (2) (since C++23)
```

1) Move assignment operator. Equivalent to `auto tmp{std::move(rhs)}; this->swap(tmp); return *this;`. After move assignment, `*this` holds the state `rhs` held before move assignment. It is implementation-defined whether `rhs` still hold the underlying buffer after move assignment.

2) The copy assignment operator is deleted; `basic_spanbuf` is not *CopyAssignable*.

### Parameters

- `rhs` - another `basic_spanbuf` that will be moved from

### Return value

`*this`

### Exceptions

May throw implementation-defined exceptions.

### Example

> Note: This section is incomplete Reason: no example

### See also

- [(constructor)](https://en.cppreference.com/w/cpp/io/basic_spanbuf/basic_spanbuf): constructs a `basic_spanbuf` object (public member function)
- [`swap`](https://en.cppreference.com/w/cpp/io/basic_spanbuf/swap): swaps two `basic_spanbuf` objects (public member function)

---
Attribution: content from https://en.cppreference.com/w/cpp/io/basic_spanbuf/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.