Added support for cpp11 compilers (only make_unique was missing)
This commit is contained in:
51
cpp14polyfills.h
Normal file
51
cpp14polyfills.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
#ifndef CPP14POLYFILLS_H
|
||||||
|
#define CPP14POLYFILLS_H
|
||||||
|
|
||||||
|
#ifndef CPP14POLYFILLS_INCLUDED
|
||||||
|
#define CPP14POLYFILLS_INCLUDED
|
||||||
|
|
||||||
|
#if __cplusplus < 201402L
|
||||||
|
|
||||||
|
// std includes
|
||||||
|
#include <memory>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <memory>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
template<class T> struct _Unique_if {
|
||||||
|
typedef unique_ptr<T> _Single_object;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T> struct _Unique_if<T[]> {
|
||||||
|
typedef 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 _Unique_if<T>::_Single_object
|
||||||
|
make_unique(Args&&... args) {
|
||||||
|
return unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
typename _Unique_if<T>::_Unknown_bound
|
||||||
|
make_unique(size_t n) {
|
||||||
|
typedef typename remove_extent<T>::type U;
|
||||||
|
return unique_ptr<T>(new U[n]());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, class... Args>
|
||||||
|
typename _Unique_if<T>::_Known_bound
|
||||||
|
make_unique(Args&&...) = delete;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __cplusplus < 201402L
|
||||||
|
|
||||||
|
#endif // CPP14POLYFILLS_INCLUDED
|
||||||
|
|
||||||
|
#endif // CPP14POLYFILLS_H
|
@@ -76,7 +76,8 @@ HEADERS += \
|
|||||||
replies/getprojectsreply.h \
|
replies/getprojectsreply.h \
|
||||||
replies/getauswertungreply.h \
|
replies/getauswertungreply.h \
|
||||||
replies/zeiterfassungreply.h \
|
replies/zeiterfassungreply.h \
|
||||||
replies/deletetimeassignmentreply.h
|
replies/deletetimeassignmentreply.h \
|
||||||
|
cpp14polyfills.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
|
@@ -23,6 +23,9 @@
|
|||||||
#include "replies/updatetimeassignmentreply.h"
|
#include "replies/updatetimeassignmentreply.h"
|
||||||
#include "replies/userinforeply.h"
|
#include "replies/userinforeply.h"
|
||||||
|
|
||||||
|
//add support for pre cpp14 compilers
|
||||||
|
#include "cpp14polyfills.h"
|
||||||
|
|
||||||
ZeiterfassungApi::ZeiterfassungApi(const QString &url, QObject *parent) :
|
ZeiterfassungApi::ZeiterfassungApi(const QString &url, QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_url(url),
|
m_url(url),
|
||||||
|
Reference in New Issue
Block a user