mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Issue #77 Reduce dependency on Qt
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
#ifndef BLACKMISC_ALGORITHM_H
|
||||
#define BLACKMISC_ALGORITHM_H
|
||||
|
||||
#include <QThreadStorage>
|
||||
#include <QRandomGenerator>
|
||||
#include <QtGlobal>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
@@ -45,16 +43,12 @@ namespace BlackMisc
|
||||
|
||||
namespace Private
|
||||
{
|
||||
//! \private A high quality deterministic pseudo-random number generator.
|
||||
//! \private A high quality pseudo-random number generator.
|
||||
//! \threadsafe
|
||||
inline std::mt19937 &defaultRandomGenerator()
|
||||
{
|
||||
//! \fixme Move rng to namespace scope to ensure destruction after function-local statics
|
||||
//! and avoid warning "thread exited after QThreadStorage destroyed".
|
||||
//! This will require careful thought about linkage.
|
||||
static QThreadStorage<std::mt19937> rng;
|
||||
if (rng.hasLocalData()) { rng.setLocalData(std::mt19937(static_cast<std::mt19937::result_type>(QRandomGenerator::global()->generate()))); }
|
||||
return rng.localData();
|
||||
thread_local std::mt19937 rng(std::random_device{}());
|
||||
return rng;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
#define BLACKMISC_INHERITANCE_TRAITS_H
|
||||
|
||||
#include "blackmisc/typetraits.h" // for void_t
|
||||
#include <QMetaType>
|
||||
#include <type_traits>
|
||||
|
||||
template <typename T>
|
||||
struct QMetaTypeId;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
class CPropertyIndex;
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#define BLACKMISC_PREDICATES_H
|
||||
|
||||
#include "blackmisc/algorithm.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <QPointer>
|
||||
#include <QObject>
|
||||
#include <QtGlobal>
|
||||
#include <QTimer>
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
|
||||
Reference in New Issue
Block a user