mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
refs #584 Moved make_unique to makeunique.h
This commit is contained in:
@@ -13,13 +13,7 @@
|
||||
#define BLACKMISC_FREEFUNCTIONS_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/tuple.h"
|
||||
#include "blackmisc/inheritancetraits.h"
|
||||
#include <QDir> // for Q_INIT_RESOURCE
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QMetaType>
|
||||
#include <memory>
|
||||
|
||||
/*!
|
||||
* Workaround, to call initResource from namespace. Used in BlackMisc::initResources().
|
||||
@@ -37,13 +31,6 @@ namespace BlackMisc
|
||||
{
|
||||
//! Init resources
|
||||
BLACKMISC_EXPORT void initResources();
|
||||
|
||||
//! Own implementation of std::make_unique, a C++14 feature not provided by GCC in C++11 mode
|
||||
template<typename T, typename... Args>
|
||||
std::unique_ptr<T> make_unique(Args &&... args)
|
||||
{
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
} // ns
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
|
||||
28
src/blackmisc/makeunique.h
Normal file
28
src/blackmisc/makeunique.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/* Copyright (C) 2016
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_MAKEUNIQUE_H
|
||||
#define BLACKMISC_MAKEUNIQUE_H
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
//! Own implementation of std::make_unique, a C++14 feature not provided by GCC in C++11 mode
|
||||
template<typename T, typename... Args>
|
||||
std::unique_ptr<T> make_unique(Args &&... args)
|
||||
{
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
|
||||
#include "blackmisc/simulation/xplane/aircraftmodelloaderxplane.h"
|
||||
#include "blackmisc/simulation/xplane/xplaneutil.h"
|
||||
|
||||
#include "blackmisc/makeunique.h"
|
||||
|
||||
using namespace BlackMisc::Simulation::FsCommon;
|
||||
using namespace BlackMisc::Simulation::XPlane;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "blackmisc/pixmap.h"
|
||||
#include <QObject>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include "blackmisc/predicates.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/makeunique.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "blackmiscfreefunctions.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/weather/presentweather.h"
|
||||
#include "blackmisc/makeunique.h"
|
||||
#include <QRegularExpression>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user