From: Michael Wallner Date: Wed, 16 Sep 2020 08:22:41 +0000 (+0200) Subject: travis: fix clang X-Git-Tag: 1.1.0-beta1~236^2~54 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=b5ed9c3cab58f1a8e519d5551951ab8c25fc3b84;p=awesomized%2Flibmemcached travis: fix clang --- diff --git a/testing/lib/random.cpp b/testing/lib/random.cpp index 9d4e8a5d..dbb30703 100644 --- a/testing/lib/random.cpp +++ b/testing/lib/random.cpp @@ -1,24 +1,8 @@ #include "testing/lib/random.hpp" #include "testing/lib/Connection.hpp" -#include -#include - #include // getpid() - -template -enable_if_t, T> random_num(T min, T max) { - using namespace chrono; - using rnd = mt19937; - using dst = uniform_int_distribution; - - auto time = duration_cast(system_clock::now().time_since_epoch()); - auto seed = static_cast(time.count() % numeric_limits::max()); - auto rgen = rnd{seed}; - return dst(min, max)(rgen); -} - unsigned random_port() { retry: auto port = random_num(2<<9, 2<<15); diff --git a/testing/lib/random.hpp b/testing/lib/random.hpp index 06fc5ef6..19ff4f8b 100644 --- a/testing/lib/random.hpp +++ b/testing/lib/random.hpp @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include #include #include @@ -10,7 +12,16 @@ using namespace std; using kv_pair = pair; template -enable_if_t, T> random_num(T min, T max); +enable_if_t, T> random_num(T min, T max) { + using namespace chrono; + using rnd = mt19937; + using dst = uniform_int_distribution; + + auto time = duration_cast(system_clock::now().time_since_epoch()); + auto seed = static_cast(time.count() % numeric_limits::max()); + auto rgen = rnd{seed}; + return dst(min, max)(rgen); +} unsigned random_port(); string random_port_string(const string &);