diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2017-03-17 13:52:23 +0100 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-03-17 13:52:46 +0100 | 
| commit | 4eb8139c8a854a856ce108a0c79a932ab9b6da70 (patch) | |
| tree | e10c14e81ac6c37e77db7300aac745c38a7f40d3 | |
| parent | 949d847ed9df6d2d2a7931f3f69014aa56a5ab7c (diff) | |
compat/util: remove our make_unique custom impl
| -rw-r--r-- | compat/make-unique.hpp | 44 | ||||
| -rw-r--r-- | compat/ndebug-guard.hpp | 2 | ||||
| -rw-r--r-- | compat/util.hpp | 2 | ||||
| -rw-r--r-- | dinput/keybinding-worker.cpp | 2 | ||||
| -rw-r--r-- | gui/main-window.cpp | 2 | 
5 files changed, 4 insertions, 48 deletions
| diff --git a/compat/make-unique.hpp b/compat/make-unique.hpp deleted file mode 100644 index 64c647b1..00000000 --- a/compat/make-unique.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -// GNU 5.4.0 doesn't have std::make_unique in -std=c++14 mode - -// this implementation was taken from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3656.htm - -#include <memory> -#include <utility> -#include <cstddef> - -namespace raii_detail { -template<class T> struct Unique_if -{ -    typedef std::unique_ptr<T> Single_object; -}; - -template<class T> struct Unique_if<T[]> -{ -    typedef std::unique_ptr<T[]> Unknown_bound; -}; - -template<class T, size_t N> struct Unique_if<T[N]> -{ -    typedef void Known_bound; -}; -} - -template<class T, class... Args> -    typename ::raii_detail::Unique_if<T>::Single_object -    make_unique(Args&&... args) { -        return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); -    } - -template<class T> -    typename ::raii_detail::Unique_if<T>::Unknown_bound -    make_unique(std::size_t n) { -        typedef typename std::remove_extent<T>::type U; -        return std::unique_ptr<T>(new U[n]()); -    } - -template<class T, class... Args> -    typename ::raii_detail::Unique_if<T>::Known_bound -    make_unique(Args&&...) = delete; - diff --git a/compat/ndebug-guard.hpp b/compat/ndebug-guard.hpp index 209177b3..e38fd0fe 100644 --- a/compat/ndebug-guard.hpp +++ b/compat/ndebug-guard.hpp @@ -1,3 +1,5 @@  #ifdef NDEBUG  #   error "NDEBUG defined, don't define it"  #endif + +#include <cassert> diff --git a/compat/util.hpp b/compat/util.hpp index 81142756..25640483 100644 --- a/compat/util.hpp +++ b/compat/util.hpp @@ -1,8 +1,6 @@  #pragma once  #include "ndebug-guard.hpp" - -#include "make-unique.hpp"  #include "run-in-thread.hpp"  #include <memory> diff --git a/dinput/keybinding-worker.cpp b/dinput/keybinding-worker.cpp index 5fbde31c..b94b762e 100644 --- a/dinput/keybinding-worker.cpp +++ b/dinput/keybinding-worker.cpp @@ -168,7 +168,7 @@ void KeybindingWorker::run()  KeybindingWorker::fun* KeybindingWorker::_add_receiver(fun& receiver)  {      QMutexLocker l(&mtx); -    receivers.push_back(std::unique_ptr<fun>(new fun(receiver))); +    receivers.push_back(std::make_unique<fun>(receiver));      fun* f = receivers[receivers.size() - 1].get();      //qDebug() << "add receiver" << (long) f;      joy_ctx.refresh(); diff --git a/gui/main-window.cpp b/gui/main-window.cpp index 8a04cab4..7efec930 100644 --- a/gui/main-window.cpp +++ b/gui/main-window.cpp @@ -686,7 +686,7 @@ void MainWindow::ensure_tray()      {          if (!tray)          { -            tray = make_unique<QSystemTrayIcon>(this); +            tray = std::make_unique<QSystemTrayIcon>(this);              tray->setIcon(QIcon(":/images/facetracknoir.png"));              tray->setContextMenu(&tray_menu);              tray->show(); | 
