QT_NO_AS_CONST: rename and add docs

Give it a name in line with the function name:
qAsConst -> QT_NO_QASCONST, as already done for qExchange.
We can do this because we never documented the macro itself.
So, while at it: also document the macro.

Change-Id: I6eb0834df438e4f4e818ef2cf8e702ed156dc253
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2024-02-16 10:51:12 +01:00
parent 5fe805dcfb
commit 03baf08d2b
3 changed files with 17 additions and 3 deletions

View File

@ -156,7 +156,7 @@ qt_internal_add_target_aliases(PlatformToolInternal)
target_link_libraries(PlatformToolInternal INTERFACE PlatformAppInternal)
qt_internal_add_global_definition(QT_NO_JAVA_STYLE_ITERATORS)
qt_internal_add_global_definition(QT_NO_AS_CONST)
qt_internal_add_global_definition(QT_NO_QASCONST)
qt_internal_add_global_definition(QT_NO_QEXCHANGE)
qt_internal_add_global_definition(QT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
qt_internal_add_global_definition(QT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH)

View File

@ -24,7 +24,7 @@ constexpr std::underlying_type_t<Enum> qToUnderlying(Enum e) noexcept
return static_cast<std::underlying_type_t<Enum>>(e);
}
#ifndef QT_NO_AS_CONST
#ifndef QT_NO_QASCONST
#if QT_DEPRECATED_SINCE(6, 6)
// this adds const to non-const objects (like std::as_const)
@ -36,7 +36,7 @@ template <typename T>
void qAsConst(const T &&) = delete;
#endif // QT_DEPRECATED_SINCE(6, 6)
#endif // QT_NO_AS_CONST
#endif // QT_NO_QASCONST
#ifndef QT_NO_QEXCHANGE

View File

@ -54,6 +54,20 @@
To prevent this construct from compiling (and failing at runtime), qAsConst() has
a second, deleted, overload which binds to rvalues.
\note You can make the qAsConst() function unavailable by defining
the \l{QT_NO_QASCONST} macro.
*/
/*!
\macro QT_NO_QASCONST
\since 6.8
\relates <QtTypeTraits>
Defining this macro removes the availability of the qAsConst()
function.
\sa qAsConst
*/
/*!