aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clientprotocol.h21
-rw-r--r--include/numeric.h20
2 files changed, 10 insertions, 31 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.
diff --git a/include/numeric.h b/include/numeric.h
index 79a569c22..9ce34b12b 100644
--- a/include/numeric.h
+++ b/include/numeric.h
@@ -50,23 +50,13 @@ class Numeric::Numeric
{
}
- /** Add a parameter pack to the numeric.
- * @param x1 The first element of the parameter pack.
- * @param x2 The rest of the parameter pack.
+ /** Converts the given arguments to a string and adds them to the numeric.
+ * @param args One or more arguments to the numeric.
*/
- template <typename T1, typename... T2>
- Numeric& push(const T1& x1, T2... x2)
+ template <typename... Args>
+ Numeric& push(const Args&... args)
{
- return push(x1).push(std::forward<T2>(x2)...);
- }
-
- /** Add a parameter to the numeric. The parameter will be converted to a string first with ConvToStr().
- * @param x The parameter to add to the numeric.
- */
- template <typename T>
- Numeric& push(const T& x)
- {
- params.push_back(ConvToStr(x));
+ (params.push_back(ConvToStr(args)), ...);
return *this;
}