mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/ChatCommands: Move ostream operator into Variant class so we don't pollute std:: (PR #25413)
(cherry picked from commit 68a4085427)
This commit is contained in:
committed by
Shauren
parent
706163743d
commit
cb2a284359
@@ -258,17 +258,13 @@ namespace Trinity::ChatCommands
|
||||
|
||||
template <typename T>
|
||||
constexpr bool holds_alternative() const { return std::holds_alternative<T>(static_cast<base const&>(*this)); }
|
||||
|
||||
template <bool C = have_operators>
|
||||
friend std::enable_if_t<C, std::ostream&> operator<<(std::ostream& os, Trinity::ChatCommands::Variant<T1, Ts...> const& v)
|
||||
{
|
||||
return (os << *v);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* make the correct operator<< to use explicit, because otherwise the compiler gets confused with the implicit std::variant conversion */
|
||||
namespace std
|
||||
{
|
||||
template <typename... Ts>
|
||||
auto operator<<(std::ostream& os, Trinity::ChatCommands::Variant<Ts...> const& v) -> std::enable_if_t<Trinity::ChatCommands::Variant<Ts...>::have_operators, std::ostream&>
|
||||
{
|
||||
return (os << *v);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user