#pragma once #include #include #include namespace phosg { inline std::partial_ordering partial_order_for_strong_order(std::strong_ordering st_order) { if (st_order < 0) { return std::partial_ordering::less; } else if (st_order > 0) { return std::partial_ordering::greater; } else { return std::partial_ordering::equivalent; } } template struct always_false { static constexpr bool v = false; }; template T enum_for_name(const char*) { static_assert(always_false::v, "unspecialized enum_for_name should never be called"); throw std::logic_error("unspecialized enum_for_name should never be called"); } template T enum_for_name(const std::string& s) { return enum_for_name(s.c_str()); } template const char* name_for_enum(T) { static_assert(always_false::v, "unspecialized name_for_enum should never be called"); throw std::logic_error("unspecialized name_for_enum should never be called"); } } // namespace phosg