diff options
author | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-09-07 00:22:37 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-02-05 13:58:04 +0100 |
commit | cb2a2843597af344db54a2ed34885e204fed5c0f (patch) | |
tree | 3fa04da61cbb21247bf276f1f3a196c862be3d9a | |
parent | 706163743d481e092111401752c9cbb056b35e69 (diff) |
Core/ChatCommands: Move ostream operator into Variant class so we don't pollute std:: (PR #25413)
(cherry picked from commit 68a4085427a898046b4afb73f6c369640418b848)
-rw-r--r-- | src/server/game/Chat/ChatCommands/ChatCommandTags.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/server/game/Chat/ChatCommands/ChatCommandTags.h b/src/server/game/Chat/ChatCommands/ChatCommandTags.h index 19872430f1c..19d3258753c 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandTags.h +++ b/src/server/game/Chat/ChatCommands/ChatCommandTags.h @@ -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)); } - }; -} -/* 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); - } + 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); + } + }; } #endif |