Extract header qtypetraits.h from qglobal.h
Task-number: QTBUG-99313 Change-Id: I6cb76607213ca5d64dec669a39e8a59e13b21497 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
9c706e2567
commit
d9544394b0
@ -85,6 +85,7 @@ qt_internal_add_module(Core
|
||||
global/qtversionchecks.h
|
||||
global/qtypeinfo.h
|
||||
global/qtypes.cpp global/qtypes.h
|
||||
global/qtypetraits.h
|
||||
global/qvolatile_p.h
|
||||
global/q20algorithm.h
|
||||
global/q20functional.h
|
||||
|
@ -2797,15 +2797,6 @@ void qAbort()
|
||||
that qExchange() returns a non-const object, so Qt containers may detach.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <typename Enum> std::underlying_type_t<Enum> qToUnderlying(Enum e)
|
||||
\relates <QtGlobal>
|
||||
\since 6.2
|
||||
|
||||
Converts the enumerator \a e to the equivalent value expressed in its
|
||||
enumeration's underlying type.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro Q_LIKELY(expr)
|
||||
\relates <QtGlobal>
|
||||
|
@ -158,13 +158,6 @@ noexcept(std::conjunction_v<std::is_nothrow_move_constructible<T>, std::is_nothr
|
||||
return old;
|
||||
}
|
||||
|
||||
// like std::to_underlying
|
||||
template <typename Enum>
|
||||
constexpr std::underlying_type_t<Enum> qToUnderlying(Enum e) noexcept
|
||||
{
|
||||
return static_cast<std::underlying_type_t<Enum>>(e);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
// We need to keep QTypeInfo, QSysInfo, QFlags, qDebug & family in qglobal.h for compatibility with Qt 4.
|
||||
@ -188,6 +181,7 @@ QT_END_NAMESPACE
|
||||
#include <QtCore/qtdeprecationmarkers.h>
|
||||
#include <QtCore/qtranslation.h>
|
||||
#include <QtCore/qtresource.h>
|
||||
#include <QtCore/qtypetraits.h>
|
||||
#include <QtCore/qversiontagging.h>
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
27
src/corelib/global/qtypetraits.h
Normal file
27
src/corelib/global/qtypetraits.h
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#ifndef QTYPETRAITS_H
|
||||
#define QTYPETRAITS_H
|
||||
|
||||
#include <QtCore/qtconfigmacros.h>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#if 0
|
||||
#pragma qt_class(QTypeTraits)
|
||||
#pragma qt_sync_stop_processing
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// like std::to_underlying
|
||||
template <typename Enum>
|
||||
constexpr std::underlying_type_t<Enum> qToUnderlying(Enum e) noexcept
|
||||
{
|
||||
return static_cast<std::underlying_type_t<Enum>>(e);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QTYPETRAITS_H
|
11
src/corelib/global/qtypetraits.qdoc
Normal file
11
src/corelib/global/qtypetraits.qdoc
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2022 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
\fn template <typename Enum> std::underlying_type_t<Enum> qToUnderlying(Enum e)
|
||||
\relates <QTypeTraits>
|
||||
\since 6.2
|
||||
|
||||
Converts the enumerator \a e to the equivalent value expressed in its
|
||||
enumeration's underlying type.
|
||||
*/
|
Loading…
Reference in New Issue
Block a user