aboutsummaryrefslogtreecommitdiffstats
path: root/include/clientprotocol.h
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-04-27 02:40:57 +0100
committerGravatar Sadie Powell2021-04-27 02:54:56 +0100
commit86cfb2375bbbb03fb1ecfbdee47ea6918a368646 (patch)
tree5e28d647f5c4faf0a559fdd3fd4749bc9449c83f /include/clientprotocol.h
parentRemove the SASL fallback event. (diff)
downloadinspircd++-86cfb2375bbbb03fb1ecfbdee47ea6918a368646.tar.gz
inspircd++-86cfb2375bbbb03fb1ecfbdee47ea6918a368646.tar.bz2
inspircd++-86cfb2375bbbb03fb1ecfbdee47ea6918a368646.zip
Use parameter pack expansion instead of recursive calls.
Diffstat (limited to 'include/clientprotocol.h')
-rw-r--r--include/clientprotocol.h21
1 files changed, 5 insertions, 16 deletions
diff --git a/include/clientprotocol.h b/include/clientprotocol.h
index c5b880d4e..c02c54ef6 100644
--- a/include/clientprotocol.h
+++ b/include/clientprotocol.h
@@ -357,24 +357,13 @@ class ClientProtocol::Message : public ClientProtocol::MessageSource
*/
void PushParam(const std::string& str) { params.emplace_back(0, str); }
- /** Add a non-string parameter to the parameter list.
- * @param param Non-string to add, will be copied.
+ /** Converts the given arguments to a string and adds them to the parameter list.
+ * @param args One or more parameters to add to the parameter list.
*/
- template<typename T>
- void PushParam(T&& param)
+ template <typename... Args>
+ void PushParam(const Args&... args)
{
- PushParam(ConvToStr(param));
- }
-
- /** Adds a variable number of parameters to the parameter list.
- * @param arg1 The first argument to push.
- * @param args A variable number of arguments to push.
- */
- template<typename FirstArg, typename... FwdArgs>
- void PushParam(FirstArg&& arg1, FwdArgs&&... args)
- {
- PushParam(arg1);
- PushParam(std::forward<FwdArgs>(args)...);
+ (PushParam(ConvToStr(args)), ...);
}
/** Add a parameter to the parameter list.