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,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

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/xplane/aircraftmodelloaderxplane.h"
#include "blackmisc/simulation/xplane/xplaneutil.h"
#include "blackmisc/makeunique.h"
using namespace BlackMisc::Simulation::FsCommon;
using namespace BlackMisc::Simulation::XPlane;

View File

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

View File

@@ -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;

View File

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