Skip to content

Commit

Permalink
Core/ChatCommands: Add support for std::array-type arguments (Trinity…
Browse files Browse the repository at this point in the history
…Core#25261)

(cherry picked from commit 30a825e)
  • Loading branch information
Carbenium authored and Shauren committed Feb 2, 2022
1 parent ed6c5c9 commit 477618b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/server/game/Chat/ChatCommands/ChatCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ struct CommandArgsConsumerSingle<std::vector<T>>
}
};

template <typename T, std::size_t C>
struct CommandArgsConsumerSingle<std::array<T, C>>
{
static char const* TryConsumeTo(std::array<T, C>& val, char const* args)
{
for (T& t : val)
{
args = CommandArgsConsumerSingle<T>::TryConsumeTo(t, args);

if (!args)
return nullptr;
}

return args;
}
};

template <>
struct CommandArgsConsumerSingle<CommandArgs*>
{
Expand Down

0 comments on commit 477618b

Please sign in to comment.