Utils: Make CTAD work with std::unexpected

Aliases are not working with CTAD before C++ 20. Instead of aliasing
some types we simply importing the namespace tl into the namespace
Utils. This enables some not aliased things too.

Change-Id: Ic61a50bedbbf7253ecb5bb1f6dc0624dcc704aa0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marco Bubke
2023-05-15 14:04:34 +02:00
parent 4195b4e7e2
commit 8b2d7977ca

View File

@@ -9,24 +9,11 @@
namespace Utils { namespace Utils {
template<class T, class E> using namespace tl;
using expected = tl::expected<T, E>;
template<class T> template<class T>
using expected_str = tl::expected<T, QString>; using expected_str = tl::expected<T, QString>;
template<class E>
using unexpected = tl::unexpected<E>;
using unexpect_t = tl::unexpect_t;
static constexpr unexpect_t unexpect{};
template<class E>
constexpr unexpected<std::decay_t<E>> make_unexpected(E &&e)
{
return tl::make_unexpected(e);
}
} // namespace Utils } // namespace Utils
//! If 'expected' has an error the error will be printed and the 'action' will be executed. //! If 'expected' has an error the error will be printed and the 'action' will be executed.