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

@@ -19,6 +19,10 @@ template<typename Tag, int Max>
struct InstanceLimiter
{
InstanceLimiter() { Increment(); }
explicit InstanceLimiter(const InstanceLimiter&) = delete;
explicit InstanceLimiter(InstanceLimiter&&) = delete;
InstanceLimiter& operator=(const InstanceLimiter&) = delete;
InstanceLimiter& operator=(InstanceLimiter&&) = delete;
~InstanceLimiter() { Decrement(); }
auto GetCount() -> int { return fCount; }

View File

@@ -19,7 +19,7 @@ namespace asio
{
class io_context;
typedef class io_context io_service;
using io_service = class io_context;
} // namespace asio
} // namespace boost

View File

@@ -48,7 +48,9 @@ public:
* to 0 set the rate to 1 GHz (which is impossible to achieve, even with a
* loop that only calls RateLimiter::maybe_sleep).
*/
RateLimiter(float rate) : tw_req(std::chrono::seconds(1)), start_time(clock::now())
explicit RateLimiter(float rate)
: tw_req(std::chrono::seconds(1))
, start_time(clock::now())
{
if (rate <= 0) {
tw_req = std::chrono::nanoseconds(1);
@@ -133,4 +135,4 @@ private:
} /* namespace mq */
} /* namespace fair */
#endif // FAIR_MQ_TOOLS_RATELIMIT_H
#endif // FAIR_MQ_TOOLS_RATELIMIT_H

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;
}