Remove extra space between closing angle brackets

The extra space between template closing angle brackets is not anymore required in C++11 (https://en.wikipedia.org/wiki/C%2B%2B11#Right_angle_bracket)
This commit is contained in:
Simon Brunel 2018-05-06 15:59:23 +02:00
parent d128a5fa8d
commit 2c8ed6e676
12 changed files with 77 additions and 77 deletions

View File

@ -73,11 +73,11 @@ public: // STATIC
inline static QPromise<T> reject(E&& error);
protected:
friend struct QtPromisePrivate::PromiseFulfill<QPromise<T> >;
friend struct QtPromisePrivate::PromiseFulfill<QPromise<T>>;
friend class QPromiseResolve<T>;
friend class QPromiseReject<T>;
QExplicitlySharedDataPointer<QtPromisePrivate::PromiseData<T> > m_d;
QExplicitlySharedDataPointer<QtPromisePrivate::PromiseData<T>> m_d;
};
template <typename T>
@ -89,7 +89,7 @@ public:
public: // STATIC
template <template <typename, typename...> class Sequence = QVector, typename ...Args>
inline static QPromise<QVector<T> > all(const Sequence<QPromise<T>, Args...>& promises);
inline static QPromise<QVector<T>> all(const Sequence<QPromise<T>, Args...>& promises);
inline static QPromise<T> resolve(const T& value);
inline static QPromise<T> resolve(T&& value);

View File

@ -24,7 +24,7 @@ public:
}
private:
QSharedPointer<QPromise<T> > m_promise;
QSharedPointer<QPromise<T>> m_promise;
};
template <>
@ -45,7 +45,7 @@ public:
}
private:
QSharedPointer<QPromise<void> > m_promise;
QSharedPointer<QPromise<void>> m_promise;
};
template <class T>
@ -67,7 +67,7 @@ public:
}
private:
QSharedPointer<QPromise<T> > m_promise;
QSharedPointer<QPromise<T>> m_promise;
};
template <typename T>
@ -184,7 +184,7 @@ inline QPromise<T> QPromiseBase<T>::timeout(int msec, E&& error) const
reject(std::move(error));
});
QtPromisePrivate::PromiseFulfill<QPromise<T> >::call(p, resolve, reject);
QtPromisePrivate::PromiseFulfill<QPromise<T>>::call(p, resolve, reject);
});
}
@ -221,19 +221,19 @@ inline QPromise<T> QPromiseBase<T>::reject(E&& error)
template <typename T>
template <template <typename, typename...> class Sequence, typename ...Args>
inline QPromise<QVector<T> > QPromise<T>::all(const Sequence<QPromise<T>, Args...>& promises)
inline QPromise<QVector<T>> QPromise<T>::all(const Sequence<QPromise<T>, Args...>& promises)
{
const int count = (int)promises.size();
if (count == 0) {
return QPromise<QVector<T> >::resolve({});
return QPromise<QVector<T>>::resolve({});
}
return QPromise<QVector<T> >([=](
const QPromiseResolve<QVector<T> >& resolve,
const QPromiseReject<QVector<T> >& reject) {
return QPromise<QVector<T>>([=](
const QPromiseResolve<QVector<T>>& resolve,
const QPromiseReject<QVector<T>>& reject) {
QSharedPointer<int> remaining(new int(count));
QSharedPointer<QVector<T> > results(new QVector<T>(count));
QSharedPointer<QVector<T>> results(new QVector<T>(count));
int i = 0;
for (const auto& promise: promises) {

View File

@ -75,11 +75,11 @@ static void qtpromise_defer(F&& f)
template <typename T>
struct PromiseDeduce
{
using Type = QtPromise::QPromise<Unqualified<T> >;
using Type = QtPromise::QPromise<Unqualified<T>>;
};
template <typename T>
struct PromiseDeduce<QtPromise::QPromise<T> >
struct PromiseDeduce<QtPromise::QPromise<T>>
: public PromiseDeduce<T>
{ };
@ -96,7 +96,7 @@ struct PromiseFulfill
};
template <typename T>
struct PromiseFulfill<QtPromise::QPromise<T> >
struct PromiseFulfill<QtPromise::QPromise<T>>
{
static void call(
const QtPromise::QPromise<T>& promise,
@ -118,7 +118,7 @@ struct PromiseFulfill<QtPromise::QPromise<T> >
};
template <>
struct PromiseFulfill<QtPromise::QPromise<void> >
struct PromiseFulfill<QtPromise::QPromise<void>>
{
template <typename TPromise, typename TResolve, typename TReject>
static void call(
@ -368,8 +368,8 @@ class PromiseDataBase : public QSharedData
{
public:
using Error = QtPromise::QPromiseError;
using Handler = std::pair<QPointer<QThread>, std::function<F> >;
using Catcher = std::pair<QPointer<QThread>, std::function<void(const Error&)> >;
using Handler = std::pair<QPointer<QThread>, std::function<F>>;
using Catcher = std::pair<QPointer<QThread>, std::function<void(const Error&)>>;
virtual ~PromiseDataBase() {}

View File

@ -22,12 +22,12 @@ public:
namespace QtPromisePrivate {
template <typename T>
struct PromiseDeduce<QFuture<T> >
struct PromiseDeduce<QFuture<T>>
: public PromiseDeduce<T>
{ };
template <typename T>
struct PromiseFulfill<QFuture<T> >
struct PromiseFulfill<QFuture<T>>
{
static void call(
const QFuture<T>& future,
@ -62,7 +62,7 @@ struct PromiseFulfill<QFuture<T> >
};
template <>
struct PromiseFulfill<QFuture<void> >
struct PromiseFulfill<QFuture<void>>
{
static void call(
const QFuture<void>& future,

View File

@ -85,7 +85,7 @@ struct ArgsOf<TReturn(T::*)(Args...) const volatile> : public ArgsTraits<Args...
{ };
template <typename T>
struct ArgsOf<std::function<T> > : public ArgsOf<T>
struct ArgsOf<std::function<T>> : public ArgsOf<T>
{ };
template <typename T>

View File

@ -27,7 +27,7 @@ static inline QPromise<void> qPromise()
}
template <typename T, template <typename, typename...> class Sequence = QVector, typename ...Args>
static inline QPromise<QVector<T> > qPromiseAll(const Sequence<QPromise<T>, Args...>& promises)
static inline QPromise<QVector<T>> qPromiseAll(const Sequence<QPromise<T>, Args...>& promises)
{
return QPromise<T>::all(promises);
}

View File

@ -56,7 +56,7 @@ void tst_future::fulfilled()
return 42;
}));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int>>::value));
QCOMPARE(p.isPending(), true);
p.then([&](int res) {
@ -72,7 +72,7 @@ void tst_future::fulfilled_void()
int result = -1;
auto p = qPromise(QtConcurrent::run([]() { }));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(p.isPending(), true);
p.then([&]() {
@ -91,7 +91,7 @@ void tst_future::rejected()
return 42;
}));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int>>::value));
QCOMPARE(p.isPending(), true);
p.fail([&](const MyException& e) {
@ -110,7 +110,7 @@ void tst_future::rejected_void()
throw MyException("foo");
}));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(p.isPending(), true);
@ -130,7 +130,7 @@ void tst_future::unhandled()
return 42;
}));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int>>::value));
QCOMPARE(p.isPending(), true);
@ -153,7 +153,7 @@ void tst_future::unhandled_void()
throw QString("foo");
}));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(p.isPending(), true);
p.fail([&](const QString& err) {
@ -307,7 +307,7 @@ void tst_future::finally()
});
});
Q_STATIC_ASSERT((std::is_same<decltype(output), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(output), QPromise<int>>::value));
QCOMPARE(input.isFulfilled(), true);
QCOMPARE(output.isPending(), true);
@ -330,7 +330,7 @@ void tst_future::finallyRejected()
});
});
Q_STATIC_ASSERT((std::is_same<decltype(output), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(output), QPromise<int>>::value));
QCOMPARE(input.isFulfilled(), true);
QCOMPARE(output.isPending(), true);

View File

@ -33,7 +33,7 @@ void tst_helpers::resolve()
int value = -1;
auto p = QtPromise::qPromise(42);
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int>>::value));
QCOMPARE(p.isFulfilled(), true);
@ -49,7 +49,7 @@ void tst_helpers::resolve_void()
int value = -1;
auto p = QtPromise::qPromise();
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(p.isFulfilled(), true);
@ -70,7 +70,7 @@ void tst_helpers::resolve_promise()
});
}));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QString> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QString>>::value));
QCOMPARE(p.isPending(), true);
@ -93,7 +93,7 @@ void tst_helpers::resolve_promise_void()
});
}));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(p.isPending(), true);
@ -115,9 +115,9 @@ void tst_helpers::allFulfilled()
});
});
auto p = qPromiseAll(QVector<QPromise<int> >{p0, p2, p1});
auto p = qPromiseAll(QVector<QPromise<int>>{p0, p2, p1});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int> > >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int>>>::value));
QCOMPARE(p.isPending(), true);
QCOMPARE(p0.isFulfilled(), true);
@ -144,9 +144,9 @@ void tst_helpers::allFulfilled_void()
});
});
auto p = qPromiseAll(QVector<QPromise<void> >{p0, p2, p1});
auto p = qPromiseAll(QVector<QPromise<void>>{p0, p2, p1});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(p.isPending(), true);
QCOMPARE(p0.isFulfilled(), true);
@ -169,9 +169,9 @@ void tst_helpers::allRejected()
});
});
auto p = qPromiseAll(QVector<QPromise<int> >{p0, p2, p1});
auto p = qPromiseAll(QVector<QPromise<int>>{p0, p2, p1});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int> > >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int>>>::value));
QCOMPARE(p.isPending(), true);
QCOMPARE(p0.isFulfilled(), true);
@ -199,9 +199,9 @@ void tst_helpers::allRejected_void()
});
});
auto p = qPromiseAll(QVector<QPromise<void> >{p0, p2, p1});
auto p = qPromiseAll(QVector<QPromise<void>>{p0, p2, p1});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(p.isPending(), true);
QCOMPARE(p0.isFulfilled(), true);
@ -220,9 +220,9 @@ void tst_helpers::allRejected_void()
void tst_helpers::allEmpty()
{
auto p = qPromiseAll(QVector<QPromise<int> >());
auto p = qPromiseAll(QVector<QPromise<int>>());
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int> > >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int>>>::value));
QCOMPARE(p.isFulfilled(), true);
@ -236,9 +236,9 @@ void tst_helpers::allEmpty()
void tst_helpers::allEmpty_void()
{
auto p = qPromiseAll(QVector<QPromise<void> >());
auto p = qPromiseAll(QVector<QPromise<void>>());
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(p.isFulfilled(), true);
}

View File

@ -31,7 +31,7 @@ struct SequenceTester
};
template <template <typename, typename...> class Sequence, typename ...Args>
struct SequenceTester<Sequence<QPromise<int>, Args...> >
struct SequenceTester<Sequence<QPromise<int>, Args...>>
{
static void exec()
{
@ -47,13 +47,13 @@ struct SequenceTester<Sequence<QPromise<int>, Args...> >
auto p = QPromise<int>::all(promises);
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int> > >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int>>>::value));
QCOMPARE(waitForValue(p, QVector<int>()), QVector<int>({42, 46, 43, 44}));
}
};
template <template <typename, typename...> class Sequence, typename ...Args>
struct SequenceTester<Sequence<QPromise<void>, Args...> >
struct SequenceTester<Sequence<QPromise<void>, Args...>>
{
static void exec()
{
@ -69,7 +69,7 @@ struct SequenceTester<Sequence<QPromise<void>, Args...> >
auto p = QPromise<void>::all(promises);
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(waitForValue(p, -1, 42), 42);
}
};
@ -78,26 +78,26 @@ struct SequenceTester<Sequence<QPromise<void>, Args...> >
void tst_qpromise_all::qList()
{
SequenceTester<QList<QPromise<int> > >::exec();
SequenceTester<QList<QPromise<void> > >::exec();
SequenceTester<QList<QPromise<int>>>::exec();
SequenceTester<QList<QPromise<void>>>::exec();
}
// QVector::push_back/append isn't supported since it requires a default
// constructor (see https://github.com/simonbrunel/qtpromise/issues/3)
//void tst_qpromise_all::qVector()
//{
// SequenceTester<QVector<QPromise<int> > >::exec();
// SequenceTester<QVector<QPromise<void> > >::exec();
// SequenceTester<QVector<QPromise<int>>>::exec();
// SequenceTester<QVector<QPromise<void>>>::exec();
//}
void tst_qpromise_all::stdList()
{
SequenceTester<std::list<QPromise<int> > >::exec();
SequenceTester<std::list<QPromise<void> > >::exec();
SequenceTester<std::list<QPromise<int>>>::exec();
SequenceTester<std::list<QPromise<void>>>::exec();
}
void tst_qpromise_all::stdVector()
{
SequenceTester<std::vector<QPromise<int> > >::exec();
SequenceTester<std::vector<QPromise<void> > >::exec();
SequenceTester<std::vector<QPromise<int>>>::exec();
SequenceTester<std::vector<QPromise<void>>>::exec();
}

View File

@ -39,7 +39,7 @@ void tst_qpromise_finally::fulfilledSync()
return 16; // ignored!
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int>>::value));
QCOMPARE(waitForValue(p, -1), 42);
QCOMPARE(p.isFulfilled(), true);
QCOMPARE(value, 8);
@ -53,7 +53,7 @@ void tst_qpromise_finally::fulfilledSync_void()
return 16; // ignored!
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(waitForValue(p, -1, 42), 42);
QCOMPARE(p.isFulfilled(), true);
QCOMPARE(value, 8);
@ -65,7 +65,7 @@ void tst_qpromise_finally::fulfilledThrows()
throw QString("bar");
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int>>::value));
QCOMPARE(waitForError(p, QString()), QString("bar"));
QCOMPARE(p.isRejected(), true);
}
@ -76,7 +76,7 @@ void tst_qpromise_finally::fulfilledThrows_void()
throw QString("bar");
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(waitForError(p, QString()), QString("bar"));
QCOMPARE(p.isRejected(), true);
}
@ -123,7 +123,7 @@ void tst_qpromise_finally::rejectedSync()
return 16; // ignored!
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int>>::value));
QCOMPARE(waitForError(p, QString()), QString("foo"));
QCOMPARE(p.isRejected(), true);
QCOMPARE(value, 8);
@ -137,7 +137,7 @@ void tst_qpromise_finally::rejectedSync_void()
return 16; // ignored!
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(waitForError(p, QString()), QString("foo"));
QCOMPARE(p.isRejected(), true);
QCOMPARE(value, 8);
@ -149,7 +149,7 @@ void tst_qpromise_finally::rejectedThrows()
throw QString("bar");
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int>>::value));
QCOMPARE(waitForError(p, QString()), QString("bar"));
QCOMPARE(p.isRejected(), true);
}
@ -160,7 +160,7 @@ void tst_qpromise_finally::rejectedThrows_void()
throw QString("bar");
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(waitForError(p, QString()), QString("bar"));
QCOMPARE(p.isRejected(), true);
}

View File

@ -56,7 +56,7 @@ void tst_qpromise_then::resolveAsync()
});
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QString> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QString>>::value));
QCOMPARE(waitForValue(p, QString()), QString("foo42"));
QCOMPARE(p.isFulfilled(), true);
}
@ -91,7 +91,7 @@ void tst_qpromise_then::rejectAsync()
});
});
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
QCOMPARE(waitForError(p, QString()), QString("foo42"));
QCOMPARE(p.isRejected(), true);
}
@ -105,7 +105,7 @@ void tst_qpromise_then::skipResult()
value = 43;
}).wait();
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<int>>::value));
QCOMPARE(value, 43);
}

View File

@ -279,7 +279,7 @@ void tst_requirements::thenMultipleCalls()
});
});
qPromiseAll(QVector<QPromise<void> >{
qPromiseAll(QVector<QPromise<void>>{
p.then([&](int r) { values << r + 1; }),
p.then([&](int r) { values << r + 2; }),
p.then([&](int r) { values << r + 3; })
@ -298,7 +298,7 @@ void tst_requirements::thenMultipleCalls()
});
});
qPromiseAll(QVector<QPromise<int> >{
qPromiseAll(QVector<QPromise<int>>{
p.then(nullptr, [&](int r) { values << r + 1; return r + 1; }),
p.then(nullptr, [&](int r) { values << r + 2; return r + 2; }),
p.then(nullptr, [&](int r) { values << r + 3; return r + 3; })
@ -314,9 +314,9 @@ void tst_requirements::thenHandlers()
{
auto handler = [](){ return 42; };
auto p1 = QPromise<int>::resolve(42);
Q_STATIC_ASSERT((std::is_same<decltype(p1.then(handler, nullptr)), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p1.then(nullptr, handler)), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p1.then(handler, handler)), QPromise<int> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p1.then(handler, nullptr)), QPromise<int>>::value));
Q_STATIC_ASSERT((std::is_same<decltype(p1.then(nullptr, handler)), QPromise<int>>::value));
Q_STATIC_ASSERT((std::is_same<decltype(p1.then(handler, handler)), QPromise<int>>::value));
}
// 2.2.7.1. If either onFulfilled or onRejected returns a value x, run the
@ -351,7 +351,7 @@ void tst_requirements::thenHandlers()
QString value;
auto p1 = QPromise<QString>::resolve("42");
auto p2 = p1.then(nullptr, [](){ return QString(); });
Q_STATIC_ASSERT((std::is_same<decltype(p2), QPromise<QString> >::value));
Q_STATIC_ASSERT((std::is_same<decltype(p2), QPromise<QString>>::value));
p2.then([&](const QString& e) { value = e; }).wait();
QVERIFY(p1.isFulfilled());