diff options
| author | 2021-04-27 02:40:57 +0100 | |
|---|---|---|
| committer | 2021-04-27 02:54:56 +0100 | |
| commit | 86cfb2375bbbb03fb1ecfbdee47ea6918a368646 (patch) | |
| tree | 5e28d647f5c4faf0a559fdd3fd4749bc9449c83f /include/numeric.h | |
| parent | Remove the SASL fallback event. (diff) | |
Use parameter pack expansion instead of recursive calls.
Diffstat (limited to 'include/numeric.h')
| -rw-r--r-- | include/numeric.h | 20 |
1 files changed, 5 insertions, 15 deletions
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; } |
