# rmp::Handle

> A reference to an object that is safe to keep across frames.

Source: https://omardev29.github.io/rmp-docs/reference/classes/rmp-Handle.html

class `#include <rmp/object.h>` [include/rmp/object.h:434](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/object.h#L434-L481)

template <class T = Object> class Handle

A reference to an object that is safe to keep across frames. It gives the object back while it is alive, and nothing from the moment `destroy()` is called on it, even once its slot holds another object. [`Object::handle()`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-Object.html#handle) makes one; T is the type `get()` hands back.

### `get`, `operator bool`, `operator->`, `operator*`

Ref<T> get() const

explicit operator bool() const

T *operator->() const

T &operator*() const

function [include/rmp/object.h:459](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/object.h#L459-L462)

Empty until it points at something, and empty again the moment that something stops existing. A default-constructed handle has generation 0, which no live slot ever has.

-> and * on a handle whose object is gone are the empty Ref's: said once, and a stand-in instead of a crash. Ask first:

```cpp
if (target) target->hp -= 1;
```

### `Handle`

Handle(unsigned index, unsigned generation)

function [include/rmp/object.h:479](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/object.h#L479-L480)

Public so [`Object::handle()`](https://omardev29.github.io/rmp-docs/reference/classes/rmp-Object.html#handle) can build one without befriending every instantiation. Not for calling: the index and generation are ours.
