# UniqueEntity

This class encapsulates an entity identifier, providing a type-safe way of handling entity IDs. The identifier can be implicitly converted to a size\_t type, and arithmetic operations are supported.

```cpp
class UniqueEntity {
public:
    /**
     * @brief Construct a new Unique Entity object
     * 
     * @param id The unique identifier for the entity.
     */
    explicit UniqueEntity(size_t id) : _id(id) {}

    /**
     * @brief Implicit conversion to size_t.
     * 
     * @return The underlying size_t identifier.
     */
    operator size_t() const { return _id; }

    /**
     * @brief Addition operator for UniqueEntity.
     * 
     * @param entity The UniqueEntity to add to.
     * @param value The value to add to the entity's ID.
     * @return A new UniqueEntity with the resulting ID.
     */
    friend inline UniqueEntity operator+(const UniqueEntity& entity, size_t value);

    /**
     * @brief Subtraction operator for UniqueEntity.
     * 
     * @param entity The UniqueEntity to subtract from.
     * @param value The value to subtract from the entity's ID.
     * @return A new UniqueEntity with the resulting ID.
     */
    friend inline UniqueEntity operator-(const UniqueEntity& entity, size_t value);

    /**
     * @brief Multiplication operator for UniqueEntity.
     * 
     * @param entity The UniqueEntity to multiply.
     * @param value The value to multiply the entity's ID by.
     * @return A new UniqueEntity with the resulting ID.
     */
    friend inline UniqueEntity operator*(const UniqueEntity& entity, size_t value);

private:
    size_t _id; ///< The unique identifier of the entity.
};
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://r-type-5.gitbook.io/r-type/development-guidelines/ecs/graphic/uniqueentity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
