// -*- C++ -*-
#ifndef _EZCXX_TYPEINFO
#define _EZCXX_TYPEINFO

#include <__config>
#include <cstddef>
#include <exception>

#pragma clang system_header

namespace std {

class type_info {
public:
    virtual ~type_info();

    _EZCXX_INLINE bool operator==(const type_info &__rhs) const noexcept { return name() == __rhs.name(); }
    _EZCXX_INLINE bool operator!=(const type_info &__rhs) const noexcept { return !(*this == __rhs); }
    _EZCXX_INLINE bool before(const type_info &__rhs) const noexcept { return name() < __rhs.name(); }

    _EZCXX_INLINE const char *name() const noexcept { return __type_name; }
    _EZCXX_INLINE size_t hash_code() { return reinterpret_cast<size_t>(name()); }

private:
    type_info(const type_info &) = delete;
    type_info &operator=(const type_info &) = delete;

    const char *__type_name;
};

_EZCXX_DECLARE_EXCEPTION(bad_cast);
_EZCXX_DECLARE_EXCEPTION(bad_typeid);

} // namespace std

#endif // _EZCXX_TYPEINFO
