Utils: Remove Utils::optional

Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Eike Ziller
2022-08-26 10:30:00 +02:00
parent 34a9491a08
commit 04e50438eb
247 changed files with 1053 additions and 3751 deletions

View File

@@ -532,22 +532,22 @@ void tst_Algorithm::take()
{
{
QList<Struct> v {1, 3, 5, 6, 7, 8, 9, 11, 13, 15, 13, 16, 17};
Utils::optional<Struct> r1 = Utils::take(v, [](const Struct &s) { return s.member == 13; });
std::optional<Struct> r1 = Utils::take(v, [](const Struct &s) { return s.member == 13; });
QVERIFY(static_cast<bool>(r1));
QCOMPARE(r1.value().member, 13);
Utils::optional<Struct> r2 = Utils::take(v, [](const Struct &s) { return s.member == 13; });
std::optional<Struct> r2 = Utils::take(v, [](const Struct &s) { return s.member == 13; });
QVERIFY(static_cast<bool>(r2));
QCOMPARE(r2.value().member, 13);
Utils::optional<Struct> r3 = Utils::take(v, [](const Struct &s) { return s.member == 13; });
std::optional<Struct> r3 = Utils::take(v, [](const Struct &s) { return s.member == 13; });
QVERIFY(!static_cast<bool>(r3));
Utils::optional<Struct> r4 = Utils::take(v, &Struct::isEven);
std::optional<Struct> r4 = Utils::take(v, &Struct::isEven);
QVERIFY(static_cast<bool>(r4));
QCOMPARE(r4.value().member, 6);
}
{
QList<Struct> v {0, 0, 0, 0, 0, 0, 1, 2, 3};
Utils::optional<Struct> r1 = Utils::take(v, &Struct::member);
std::optional<Struct> r1 = Utils::take(v, &Struct::member);
QVERIFY(static_cast<bool>(r1));
QCOMPARE(r1.value().member, 1);
}