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