1
0
Fork 0

Adjust code for some older GCC versions

Implicit conversion from raw-pointer to std::unique_ptr<T> was failing,
use a stub replacement for std::make_unqiue to wrap this up cleanly.
This commit is contained in:
James Turner 2019-05-27 11:38:37 +01:00
parent 7738f33306
commit 4ed410dc09

View file

@ -1,5 +1,5 @@
// dbus-dispatcher.cpp
//
// dbus-dispatcher.cpp
//
// Copyright (C) 2019 - swift Project Community / Contributors (http://swift-project.org/)
// Adapted to Flightgear by Lars Toenning <dev@ltoenning.de>
//
@ -21,6 +21,15 @@
#include "dbusconnection.h"
#include <algorithm>
namespace { // anonymosu namespace
template <typename T, typename... Args>
std::unique_ptr<T> our_make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
} // end of anonymous namespace
namespace FGSwiftBus
{
@ -198,7 +207,7 @@ namespace FGSwiftBus
if (dbus_watch_get_enabled(watch) == FALSE) { return true; }
int fd = dbus_watch_get_unix_fd(watch);
m_watchers.emplace(fd, new WatchHandler(m_eventBase.get(), watch));
m_watchers.emplace(fd, our_make_unique<WatchHandler>(m_eventBase.get(), watch));
return true;
}