refs #584 Moved make_unique to makeunique.h

This commit is contained in:
Mathew Sutcliffe
2016-02-08 00:36:00 +00:00
parent 3bdcd7e386
commit 451b90e4f9
9 changed files with 36 additions and 15 deletions

View File

@@ -13,6 +13,7 @@
#include "audiomixervatlib.h" #include "audiomixervatlib.h"
#include "blackmisc/logmessage.h" #include "blackmisc/logmessage.h"
#include "blackmisc/blackmiscfreefunctions.h" #include "blackmisc/blackmiscfreefunctions.h"
#include "blackmisc/makeunique.h"
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
#include <memory> #include <memory>

View File

@@ -13,13 +13,7 @@
#define BLACKMISC_FREEFUNCTIONS_H #define BLACKMISC_FREEFUNCTIONS_H
#include "blackmisc/blackmiscexport.h" #include "blackmisc/blackmiscexport.h"
#include "blackmisc/tuple.h"
#include "blackmisc/inheritancetraits.h"
#include <QDir> // for Q_INIT_RESOURCE #include <QDir> // for Q_INIT_RESOURCE
#include <QList>
#include <QVariant>
#include <QMetaType>
#include <memory>
/*! /*!
* Workaround, to call initResource from namespace. Used in BlackMisc::initResources(). * Workaround, to call initResource from namespace. Used in BlackMisc::initResources().
@@ -37,13 +31,6 @@ namespace BlackMisc
{ {
//! Init resources //! Init resources
BLACKMISC_EXPORT void initResources(); 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 #endif // guard

View 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

View File

@@ -12,7 +12,7 @@
#include "blackmisc/simulation/fscommon/aircraftcfgparser.h" #include "blackmisc/simulation/fscommon/aircraftcfgparser.h"
#include "blackmisc/simulation/xplane/aircraftmodelloaderxplane.h" #include "blackmisc/simulation/xplane/aircraftmodelloaderxplane.h"
#include "blackmisc/simulation/xplane/xplaneutil.h" #include "blackmisc/simulation/xplane/xplaneutil.h"
#include "blackmisc/makeunique.h"
using namespace BlackMisc::Simulation::FsCommon; using namespace BlackMisc::Simulation::FsCommon;
using namespace BlackMisc::Simulation::XPlane; using namespace BlackMisc::Simulation::XPlane;

View File

@@ -18,6 +18,7 @@
#include "blackmisc/pixmap.h" #include "blackmisc/pixmap.h"
#include <QObject> #include <QObject>
#include <atomic> #include <atomic>
#include <memory>
namespace BlackMisc namespace BlackMisc
{ {

View File

@@ -12,6 +12,7 @@
#include "blackmisc/simulation/fscommon/fscommonutil.h" #include "blackmisc/simulation/fscommon/fscommonutil.h"
#include "blackmisc/predicates.h" #include "blackmisc/predicates.h"
#include "blackmisc/logmessage.h" #include "blackmisc/logmessage.h"
#include "blackmisc/makeunique.h"
using namespace BlackMisc; using namespace BlackMisc;
using namespace BlackMisc::Simulation; using namespace BlackMisc::Simulation;

View File

@@ -11,6 +11,7 @@
#include "blackmiscfreefunctions.h" #include "blackmiscfreefunctions.h"
#include "blackmisc/logmessage.h" #include "blackmisc/logmessage.h"
#include "blackmisc/weather/presentweather.h" #include "blackmisc/weather/presentweather.h"
#include "blackmisc/makeunique.h"
#include <QRegularExpression> #include <QRegularExpression>
#include <QDebug> #include <QDebug>

View File

@@ -16,6 +16,7 @@
#include "blackmisc/blackmiscfreefunctions.h" #include "blackmisc/blackmiscfreefunctions.h"
#include "blackmisc/simulation/modelmappingsprovider.h" #include "blackmisc/simulation/modelmappingsprovider.h"
#include "blackmisc/geo/coordinategeodetic.h" #include "blackmisc/geo/coordinategeodetic.h"
#include "blackmisc/makeunique.h"
#include <QDBusServiceWatcher> #include <QDBusServiceWatcher>
#include <QTimer> #include <QTimer>
#include <QString> #include <QString>

View File

@@ -5,6 +5,7 @@
#include "menus.h" #include "menus.h"
#include "blackmisc/blackmiscfreefunctions.h" #include "blackmisc/blackmiscfreefunctions.h"
#include "blackmisc/makeunique.h"
#include <type_traits> #include <type_traits>
#include <cassert> #include <cassert>
#include <string> #include <string>