Fix various clang-tidy warnings

This commit is contained in:
Dennis Klein
2019-07-22 10:38:38 +02:00
committed by Dennis Klein
parent a65f0e6777
commit 499ffcd300
9 changed files with 23 additions and 12 deletions

View File

@@ -9,6 +9,8 @@
#ifndef FAIR_MQ_TOOLS_STRINGS_H
#define FAIR_MQ_TOOLS_STRINGS_H
#include <array>
#include <boost/beast/core/span.hpp>
#include <initializer_list>
#include <sstream>
#include <string>
@@ -33,15 +35,16 @@ auto ToString(T&&... t) -> std::string
}
/// @brief convert command line arguments from main function to vector of strings
inline auto ToStrVector(const int argc, char* const argv[], const bool dropProgramName = true) -> std::vector<std::string>
inline auto ToStrVector(const int argc, char*const* argv, const bool dropProgramName = true) -> std::vector<std::string>
{
auto res = std::vector<std::string>{};
boost::beast::span<char*const> argvView(argv, argc);
if (dropProgramName)
{
res.assign(argv + 1, argv + argc);
res.assign(argvView.begin() + 1, argvView.end());
} else
{
res.assign(argv, argv + argc);
res.assign(argvView.begin(), argvView.end());
}
return res;
}