silence enum stringification warnings by first casting to underlying types

This commit is contained in:
mjk 2021-03-20 21:29:37 +00:00 committed by LAGonauta
parent 17c1172d84
commit 1698d15f7d

View file

@ -55,8 +55,11 @@ namespace impl
std::optional<hresult> get_if_hresult_error(std::exception_ptr) noexcept; std::optional<hresult> get_if_hresult_error(std::exception_ptr) noexcept;
} }
template<typename OStream, typename T> template<typename OStream, typename T, std::enable_if_t<!std::is_enum_v<T>,int> = 0>
inline auto &describe_argument(OStream &s, const T &a) { return s << a; } inline auto &describe_argument(OStream &s, const T &a) { return s << a; }
template<typename OStream, typename T, std::enable_if_t< std::is_enum_v<T>,int> = 0>
inline auto &describe_argument(OStream &s, const T &a) { return s << static_cast<std::underlying_type_t<T>>(a); }
template<typename OStream> template<typename OStream>
inline auto &describe_argument(OStream &s, std::string_view const a) { return s << std::quoted(a); } inline auto &describe_argument(OStream &s, std::string_view const a) { return s << std::quoted(a); }
template<typename OStream> template<typename OStream>