The Entity class represents a unique entity in an Entity-Component-System (ECS) architecture. Entities are identified by a unique ID and are compared based on this ID.

namespace ecs {
    class Entity {
      public:
        Entity(std::size_t id) : _id(id) {}

        std::size_t getId() const
        {
            return _id;
        }

        std::size_t operator=(const std::size_t &id)
        {
            _id = id;
            return id;
        }

        bool operator==(const Entity &other) const
        {
            return _id == other._id;
        }

      private:
        std::size_t _id;
    };
} // namespace ecs

Public Members:

Private Members:


Supplement: