
#ifndef PLS_UNIQUE_ID_H
#define PLS_UNIQUE_ID_H

#include <typeindex>
#include <tuple>
#include <stdint.h>

namespace pls {
namespace internal {
namespace helpers {

struct unique_id {
  const uint32_t id_;
  const std::type_info &type_;
  bool operator==(const unique_id &other) const { return id_ == other.id_ && type_ == other.type_; }

  static constexpr unique_id create(const uint32_t id) {
    return unique_id(id, typeid(void));
  }
  template<typename ...T>
  static constexpr unique_id create() {
    return unique_id(UINT32_MAX, typeid(std::tuple<T...>));
  }
 private:
  explicit constexpr unique_id(const uint32_t id, const std::type_info &type) : id_{id}, type_{type} {};
};

}
}
}

#endif //PLS_UNIQUE_ID_H
