From e292187789f9449d1a57aa893e3b761ac5cb9871 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 9 Jan 2023 16:24:20 +0100 Subject: [PATCH] Move q20::remove_cvref to q20type_traits.h The original is defined in , not . Change-Id: I596e56f64d2eed609ad2f7e6f03ae006afaa2fa9 Reviewed-by: Thiago Macieira (cherry picked from commit def2a3de3741410bbf7ab31b59afc27b0777e09b) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/CMakeLists.txt | 1 + src/corelib/global/q20functional.h | 13 --------- src/corelib/global/q20type_traits.h | 43 +++++++++++++++++++++++++++++ src/corelib/global/qxpfunctional.h | 2 +- src/corelib/text/qanystringview.h | 2 +- 5 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 src/corelib/global/q20type_traits.h diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 8fc301e27f0..8742a646f1d 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -103,6 +103,7 @@ qt_internal_add_module(Core global/q20algorithm.h global/q20functional.h global/q20iterator.h + global/q20type_traits.h global/q23functional.h global/qxpfunctional.h global/qxptype_traits.h diff --git a/src/corelib/global/q20functional.h b/src/corelib/global/q20functional.h index 7ba10bd4b1b..a39b4fceb3d 100644 --- a/src/corelib/global/q20functional.h +++ b/src/corelib/global/q20functional.h @@ -41,19 +41,6 @@ struct identity #endif // __cpp_lib_ranges } // namespace q20 -namespace q20 { -// like std::remove_cvref(_t) -#ifdef __cpp_lib_remove_cvref -using std::remove_cvref; -using std::remove_cvref_t; -#else -template -struct remove_cvref : std::remove_cv> {}; -template -using remove_cvref_t = std::remove_cv_t>; -#endif // __cpp_lib_remove_cvref -} - QT_END_NAMESPACE #endif /* Q20FUNCTIONAL_H */ diff --git a/src/corelib/global/q20type_traits.h b/src/corelib/global/q20type_traits.h new file mode 100644 index 00000000000..2e812ed39c7 --- /dev/null +++ b/src/corelib/global/q20type_traits.h @@ -0,0 +1,43 @@ +// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#ifndef Q20TYPE_TRAITS_H +#define Q20TYPE_TRAITS_H + +#include + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. Types and functions defined in this +// file can reliably be replaced by their std counterparts, once available. +// You may use these definitions in your own code, but be aware that we +// will remove them once Qt depends on the C++ version that supports +// them in namespace std. There will be NO deprecation warning, the +// definitions will JUST go away. +// +// If you can't agree to these terms, don't use these definitions! +// +// We mean it. +// + +#include + +QT_BEGIN_NAMESPACE + +namespace q20 { +// like std::remove_cvref(_t) +#ifdef __cpp_lib_remove_cvref +using std::remove_cvref; +using std::remove_cvref_t; +#else +template +using remove_cvref = std::remove_cv>; +template +using remove_cvref_t = std::remove_cv_t>; +#endif // __cpp_lib_remove_cvref +} + +QT_END_NAMESPACE + +#endif /* Q20TYPE_TRAITS_H */ diff --git a/src/corelib/global/qxpfunctional.h b/src/corelib/global/qxpfunctional.h index 96570597535..abe00087adb 100644 --- a/src/corelib/global/qxpfunctional.h +++ b/src/corelib/global/qxpfunctional.h @@ -22,7 +22,7 @@ // #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/corelib/text/qanystringview.h b/src/corelib/text/qanystringview.h index ff9d0f9d8f6..c7a20077fcc 100644 --- a/src/corelib/text/qanystringview.h +++ b/src/corelib/text/qanystringview.h @@ -10,7 +10,7 @@ #ifdef __cpp_impl_three_way_comparison #include #endif -#include +#include #include class tst_QAnyStringView;