mirror of
https://github.com/simonbrunel/qtpromise.git
synced 2025-07-05 08:45:23 +08:00
Fix MSVC 2013 compilation issues
This commit is contained in:
@ -32,9 +32,13 @@ public:
|
||||
bool isRejected() const { return m_d->isRejected(); }
|
||||
bool isPending() const { return m_d->isPending(); }
|
||||
|
||||
template <typename TFulfilled, typename TRejected = std::nullptr_t>
|
||||
template <typename TFulfilled, typename TRejected>
|
||||
inline typename QtPromisePrivate::PromiseHandler<T, TFulfilled>::Promise
|
||||
then(const TFulfilled& fulfilled, const TRejected& rejected = nullptr) const;
|
||||
then(const TFulfilled& fulfilled, const TRejected& rejected) const;
|
||||
|
||||
template <typename TFulfilled>
|
||||
inline typename QtPromisePrivate::PromiseHandler<T, TFulfilled>::Promise
|
||||
then(TFulfilled&& fulfilled) const;
|
||||
|
||||
template <typename TRejected>
|
||||
inline typename QtPromisePrivate::PromiseHandler<T, std::nullptr_t>::Promise
|
||||
@ -67,7 +71,7 @@ protected:
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class QPromise: public QPromiseBase<T>
|
||||
class QPromise : public QPromiseBase<T>
|
||||
{
|
||||
public:
|
||||
template <typename F>
|
||||
@ -82,7 +86,7 @@ private:
|
||||
};
|
||||
|
||||
template <>
|
||||
class QPromise<void>: public QPromiseBase<void>
|
||||
class QPromise<void> : public QPromiseBase<void>
|
||||
{
|
||||
public:
|
||||
template <typename F>
|
||||
|
@ -122,6 +122,14 @@ QPromiseBase<T>::then(const TFulfilled& fulfilled, const TRejected& rejected) co
|
||||
return next;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename TFulfilled>
|
||||
inline typename QtPromisePrivate::PromiseHandler<T, TFulfilled>::Promise
|
||||
QPromiseBase<T>::then(TFulfilled&& fulfilled) const
|
||||
{
|
||||
return then(std::forward<TFulfilled>(fulfilled), nullptr);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename TRejected>
|
||||
inline typename QtPromisePrivate::PromiseHandler<T, std::nullptr_t>::Promise
|
||||
|
@ -508,7 +508,7 @@ private:
|
||||
template <>
|
||||
class PromiseData<void> : public PromiseDataBase<void, void()>
|
||||
{
|
||||
using Handler = typename PromiseDataBase<void, void()>::Handler;
|
||||
using Handler = PromiseDataBase<void, void()>::Handler;
|
||||
|
||||
public:
|
||||
void resolve()
|
||||
|
@ -16,18 +16,18 @@ using Unqualified = typename std::remove_cv<typename std::remove_reference<T>::t
|
||||
|
||||
/*!
|
||||
* \struct HasCallOperator
|
||||
* http://stackoverflow.com/a/5839442
|
||||
* http://stackoverflow.com/a/5117641
|
||||
*/
|
||||
template <typename T>
|
||||
struct HasCallOperator
|
||||
{
|
||||
template <class U>
|
||||
static auto check(const U* u)
|
||||
-> decltype(&U::operator(), char(0));
|
||||
template <typename U>
|
||||
static char check(decltype(&U::operator(), char(0)));
|
||||
|
||||
static std::array<char, 2> check(...);
|
||||
template <typename U>
|
||||
static char (&check(...))[2];
|
||||
|
||||
static const bool value = (sizeof(check((T*)0)) == 1);
|
||||
static const bool value = (sizeof(check<T>(0)) == 1);
|
||||
};
|
||||
|
||||
/*!
|
||||
|
Reference in New Issue
Block a user