From 8c09228b39b8092e47e3284416e819fb39a81e08 Mon Sep 17 00:00:00 2001 From: Flakebi Date: Sun, 16 Aug 2015 21:05:52 +0200 Subject: [PATCH] Remove underscores and add a comment --- src/utils/string_utils.hpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/utils/string_utils.hpp b/src/utils/string_utils.hpp index c9f723e77..c6407c1e0 100644 --- a/src/utils/string_utils.hpp +++ b/src/utils/string_utils.hpp @@ -143,27 +143,32 @@ namespace StringUtils // ------------------------------------------------------------------------ /** Intermediate struct to fill a vector using variadic templates */ - struct __FillStringVector + struct FillStringVector { + /** FillS takes a vector as the first argument and a variadic list of + * arguments. The arguments are recursively inserted into the vector + * which will contain all the arguments converted to strings in the end. + */ template - static void __FillS(std::vector &all_vals, T&& v, Args &&...args) + static void FillS(std::vector &all_vals, T&& v, Args &&...args) { std::ostringstream oss; oss << v; all_vals.push_back(oss.str()); - __FillS(all_vals, std::forward(args)...); + FillS(all_vals, std::forward(args)...); } - static void __FillS(std::vector&) {} + static void FillS(std::vector&) {} + /** This functions does the same as FillS but for wide strings. */ template - static void __FillW(std::vector &all_vals, T&& v, Args &&...args) + static void FillW(std::vector &all_vals, T&& v, Args &&...args) { all_vals.push_back(irr::core::stringw(std::forward(v))); - __FillW(all_vals, std::forward(args)...); + FillW(all_vals, std::forward(args)...); } - static void __FillW(std::vector&) {} + static void FillW(std::vector&) {} }; template @@ -171,7 +176,7 @@ namespace StringUtils { std::vector all_vals; all_vals.reserve(sizeof...(args)); - __FillStringVector::__FillS(all_vals, std::forward(args)...); + FillStringVector::FillS(all_vals, std::forward(args)...); return insertValues(s, all_vals); } @@ -187,7 +192,7 @@ namespace StringUtils { std::vector all_vals; all_vals.reserve(sizeof...(args)); - __FillStringVector::__FillW(all_vals, std::forward(args)...); + FillStringVector::FillW(all_vals, std::forward(args)...); return insertValues(s, all_vals); }