tst_bench_QCryptographicHash: port from std::function to qxp::function_ref
Because we can, and because function_ref is never null. Pick-to: 6.5 Change-Id: If71f98860d72eaa8cf8a93bb3c59a0260d3c7660 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
f1b264f9ac
commit
0eccfe5e39
@ -11,7 +11,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include <functional>
|
#include <qxpfunctional.h>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -45,9 +45,8 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
const int MaxBlockSize = 65536;
|
const int MaxBlockSize = 65536;
|
||||||
|
|
||||||
static void for_each_algorithm(std::function<void(QCryptographicHash::Algorithm, const char*)> f)
|
static void for_each_algorithm(qxp::function_ref<void(QCryptographicHash::Algorithm, const char*) const> f)
|
||||||
{
|
{
|
||||||
Q_ASSERT(f);
|
|
||||||
using A = QCryptographicHash::Algorithm;
|
using A = QCryptographicHash::Algorithm;
|
||||||
static const auto metaEnum = QMetaEnum::fromType<A>();
|
static const auto metaEnum = QMetaEnum::fromType<A>();
|
||||||
for (int i = 0, value = metaEnum.value(i); value != -1; value = metaEnum.value(++i))
|
for (int i = 0, value = metaEnum.value(i); value != -1; value = metaEnum.value(++i))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user