# Dispose

<a id="dispose-2"></a>

# Dispose

```cpp
template<class T>
struct Dispose
```

[Defined in src/base/include/icy/memory.h:220](https://github.com/auscaster/icey/blob/main/src/base/include/icy/memory.h#L220)

Deleter functor that calls dispose() on the pointer. Useful with std::unique_ptr for objects that require a dispose() call rather than direct deletion.

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
| `void` | [`operator()`](#operator-195) `inline` | Calls ptr->dispose() if ptr is non-null. |

---

<a id="operator-195"></a>

### operator()

`inline`

```cpp
inline void operator()(T * ptr)
```

[Defined in src/base/include/icy/memory.h:224](https://github.com/auscaster/icey/blob/main/src/base/include/icy/memory.h#L224)

Calls ptr->dispose() if ptr is non-null.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `ptr` | `T *` | Pointer to dispose; may be nullptr. |
