Long live \constraints!

We have divergence in the way we document function, operator and
constructor constraints. About half use \note, while the other
doesn't. Some say "if and only if" while others say just "participates
only if".

So add a qdoc macro, \constraints, to semantically mark up these
constraints. It expands to a section titled `Constraints`, and
uses a predefined sentence (prefix) for constraints.

Documentation for constraints is moved to the end of the comment
blocks to separate them from the rest of the text.

Apply them to all the standard-ish constraint documentation blocks
(grepped for "participate"). I didn't look for other, one-off, ways
documentation authors may have documented constraints, but I'm also
not aware of any.

Re-wrap lines only if the result fits into a single line.

As a drive-by, drop additional "if"s, as in "only if X and -if- Y" to
make the texts work with the `Constraints` section.

Fixes: QTBUG-106871
Pick-to: 6.8 6.5
Change-Id: I18c2f9f734474017264e49165389f8c9c7f34030
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b7a67b46e66f161def5bf879f19c66d3fcec1d8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2025-02-06 08:15:36 +01:00 committed by Qt Cherry-pick Bot
parent f87929371a
commit bcdd7c260b
21 changed files with 123 additions and 141 deletions

View File

@ -147,6 +147,11 @@ macro.youtube.DocBook = "<db:mediaobject>\n" \
"</db:imageobject>\n" \
"</db:mediaobject>\n"
#
# C++ constrained function templates
#
macro.constraints = "\\section1 Constraints\n\nParticipates in overload resolution only if "
macro.excludefromcreator = "\\meta tag broken"
macro.preliminarycmakecommand = "\\note This command is in technology preview and may change in future releases."

View File

@ -1287,9 +1287,6 @@ CHECK(strong, equivalent);
Implements three-way comparison of integral types.
\note This function participates in overload resolution only if both
\c LeftInt and \c RightInt are built-in integral types.
Returns \c {lhs <=> rhs}, provided \c LeftInt and \c RightInt are built-in
integral types. Unlike \c {operator<=>()}, this function template is also
available in C++17. See
@ -1315,6 +1312,9 @@ CHECK(strong, equivalent);
Returns an instance of \l Qt::strong_ordering that represents the relation
between \a lhs and \a rhs.
\constraints both
\c LeftInt and \c RightInt are built-in integral types.
*/
/*!
@ -1325,9 +1325,6 @@ CHECK(strong, equivalent);
Implements three-way comparison of floating point types.
\note This function participates in overload resolution only if both
\c LeftFloat and \c RightFloat are built-in floating-point types.
Returns \c {lhs <=> rhs}, provided \c LeftFloat and \c RightFloat are
built-in floating-point types. Unlike \c {operator<=>()}, this function
template is also available in C++17. See
@ -1354,6 +1351,9 @@ CHECK(strong, equivalent);
Returns an instance of \l Qt::partial_ordering that represents the relation
between \a lhs and \a rhs. If \a lhs or \a rhs is not a number (NaN),
\l Qt::partial_ordering::unordered is returned.
\constraints both
\c LeftFloat and \c RightFloat are built-in floating-point types.
*/
/*!
@ -1364,16 +1364,16 @@ CHECK(strong, equivalent);
Implements three-way comparison of integral and floating point types.
\note This function participates in overload resolution only if \c IntType
is a built-in integral type and \c FloatType is a built-in floating-point
type.
This function converts \a lhs to \c FloatType and calls the overload for
floating-point types.
Returns an instance of \l Qt::partial_ordering that represents the relation
between \a lhs and \a rhs. If \a rhs is not a number (NaN),
\l Qt::partial_ordering::unordered is returned.
\constraints \c IntType
is a built-in integral type and \c FloatType is a built-in floating-point
type.
*/
/*!
@ -1384,16 +1384,16 @@ CHECK(strong, equivalent);
Implements three-way comparison of floating point and integral types.
\note This function participates in overload resolution only if \c FloatType
is a built-in floating-point type and \c IntType is a built-in integral
type.
This function converts \a rhs to \c FloatType and calls the overload for
floating-point types.
Returns an instance of \l Qt::partial_ordering that represents the relation
between \a lhs and \a rhs. If \a lhs is not a number (NaN),
\l Qt::partial_ordering::unordered is returned.
\constraints \c FloatType
is a built-in floating-point type and \c IntType is a built-in integral
type.
*/
#if QT_DEPRECATED_SINCE(6, 8)
@ -1407,12 +1407,12 @@ CHECK(strong, equivalent);
Implements three-way comparison of pointers.
\note This function participates in overload resolution if \c LeftType and
\c RightType are the same type, or base and derived types. It is also used
to compare any pointer to \c {std::nullptr_t}.
Returns an instance of \l Qt::strong_ordering that represents the relation
between \a lhs and \a rhs.
\constraints \c LeftType and
\c RightType are the same type, or base and derived types. It is also used
to compare any pointer to \c {std::nullptr_t}.
*/
#endif // QT_DEPRECATED_SINCE(6, 8)
@ -1424,14 +1424,13 @@ CHECK(strong, equivalent);
Implements three-way comparison of enum types.
\note This function participates in overload resolution only if \c Enum
is an enum type.
This function converts \c Enum to its underlying type and calls the
overload for integral types.
Returns an instance of \l Qt::strong_ordering that represents the relation
between \a lhs and \a rhs.
\constraints \c Enum is an enum type.
*/
/*!
@ -1445,11 +1444,10 @@ CHECK(strong, equivalent);
\l {https://en.cppreference.com/w/cpp/language/operator_comparison#Pointer_total_order}
{strict total order over pointers} when doing the comparison.
\note This function participates in overload resolution if \c T and \c U
are the same type, or base and derived types.
Returns an instance of \l Qt::strong_ordering that represents the relation
between \a lhs and \a rhs.
\constraints \c T and \c U are the same type, or base and derived types.
*/
/*!
@ -1463,11 +1461,10 @@ CHECK(strong, equivalent);
\l {https://en.cppreference.com/w/cpp/language/operator_comparison#Pointer_total_order}
{strict total order over pointers} when doing the comparison.
\note This function participates in overload resolution if \c T and \c U
are the same type, or base and derived types.
Returns an instance of \l Qt::strong_ordering that represents the relation
between \a lhs and \a rhs.
\constraints \c T and \c U are the same type, or base and derived types.
*/
/*!
@ -1481,11 +1478,10 @@ CHECK(strong, equivalent);
\l {https://en.cppreference.com/w/cpp/language/operator_comparison#Pointer_total_order}
{strict total order over pointers} when doing the comparison.
\note This function participates in overload resolution if \c T and \c U
are the same type, or base and derived types.
Returns an instance of \l Qt::strong_ordering that represents the relation
between \a lhs and \a rhs.
\constraints \c T and \c U are the same type, or base and derived types.
*/
/*!

View File

@ -992,8 +992,7 @@ QDebug &QDebug::resetFormat()
\since 6.9
Prints the Qt or std ordering value \a t to the \a debug object.
\note This function only participates in overload resolution if \c T
is one of <Qt/Std>::<weak/partial/strong>_ordering.
\constraints \c T is one of <Qt/Std>::<weak/partial/strong>_ordering.
*/
/*!

View File

@ -22,7 +22,7 @@
QJniArray instance that wraps it.
//! [forward-iterable-containers]
This function only participates in overload resolution if \c{Container}
\constraints \c{Container}
is a container that stores elements of a \l{JNI types}{JNI type} or equivalent
C++ type, and provides a forward iterator.
@ -275,7 +275,7 @@
Constructs a QJniArray by copying \a other. Both QJniArray objects will
reference the same Java array object.
This constructor only participates in overload resolution if the element
\constraints the element
type \c{Other} of \a other is convertible to the element type \c{T} of the
QJniArray being constructed. However, no actual conversion takes place.
*/
@ -286,7 +286,7 @@
Constructs a QJniArray by moving from \a other. The \a other array becomes
\l{QJniArrayBase::isValid}{invalid}.
This constructor only participates in overload resolution if the element
\constraints the element
type \c{Other} of \a other is convertible to the element type \c{T} of the
QJniArray being constructed. However, no actual conversion takes place.
*/
@ -297,7 +297,7 @@
Assigns \a other to this QJniArray, and returns a reference to this. Both
QJniArray objects will reference the same Java array object.
This operator only participates in overload resolution if the element
\constraints the element
type \c{Other} of \a other is convertible to the element type \c{T} of this
QJniArray. However, no actual conversion takes place.
*/
@ -308,7 +308,7 @@
Moves \a other into this QJniArray, and returns a reference to this. The
\a other array becomes \l{QJniArrayBase::isValid}{invalid}.
This operator only participates in overload resolution if the element
\constraints the element
type \c{Other} of \a other is convertible to the element type \c{T} of this
QJniArray. However, no actual conversion takes place.
*/

View File

@ -249,8 +249,7 @@
This function converts the \a degrees in double to radians;
the angle is casted to a double before the conversion.
This function participates in overload resolution if and only if
\c Integral is an integral type.
\constraints \c Integral is an integral type.
\sa qRadiansToDegrees()
*/

View File

@ -243,8 +243,8 @@ Q_LOGGING_CATEGORY(lcPermissions, "qt.permissions", QtWarningMsg);
You do not need to construct this type explicitly, as the type is automatically
used when checking or requesting permissions.
This constructor participates in overload resolution only if \c T is one of
the \l{typed permission} classes:
\constraints
\c T is one of the \l{typed permission} classes:
\annotatedlist permissions
*/
@ -257,8 +257,8 @@ Q_LOGGING_CATEGORY(lcPermissions, "qt.permissions", QtWarningMsg);
Use type() for dynamically choosing which typed permission to request.
This function participates in overload resolution only if \c T is one of
the \l{typed permission} classes:
\constraints
\c T is one of the \l{typed permission} classes:
\annotatedlist permissions
*/

View File

@ -125,8 +125,7 @@
Conversion assignment operator. Makes this guarded pointer guard the
same object guarded by \a other.
\note This operator participates in overload resolution only if \c{X*}
is convertible to \c{T*}.
\constraints \c{X*} is convertible to \c{T*}.
*/
/*!
@ -136,8 +135,7 @@
Conversion move-assignment operator. Makes this guarded pointer guard the
same object guarded by \a other and resets \a other to nullptr.
\note This operator participates in overload resolution only if \c{X*}
is convertible to \c{T*}.
\constraints \c{X*} is convertible to \c{T*}.
*/
/*!

View File

@ -559,12 +559,11 @@ QVariant::QVariant(const QVariant &p)
value is is initialized with the arguments
\c{std::forward<Args>(args)...}.
This overload only participates in overload resolution if \c T can be
constructed from \a args.
This constructor is provided for STL/std::any compatibility.
\overload
\constraints \c T can be constructed from \a args.
*/
/*!

View File

@ -145,8 +145,7 @@ QT_BEGIN_NAMESPACE
The behavior is undefined if \a len is negative or, when positive, if \a str is \nullptr.
This constructor only participates in overload resolution if \c Char is a compatible
character type.
\constraints \c Char is a compatible character type.
\sa isNull(), {Compatible Character Types}
*/
@ -165,8 +164,7 @@ QT_BEGIN_NAMESPACE
The behavior is undefined if \a last precedes \a first, or \a first
is \nullptr and \a last is not.
This constructor only participates in overload resolution if \c Char
is a compatible character type.
\constraints \c Char is a compatible character type.
\sa isNull(), {Compatible Character Types}
*/
@ -181,9 +179,8 @@ QT_BEGIN_NAMESPACE
Passing \nullptr as \a str is safe and results in a null string view.
This constructor only participates in overload resolution if \a
str is not an array and if \c Char is a compatible character
type.
\constraints \a str is not an array and \c Char is a
compatible character type.
\sa isNull(), {Compatible Character Types}
*/
@ -199,7 +196,7 @@ QT_BEGIN_NAMESPACE
\a string must remain valid for the lifetime of this string view
object.
This constructor only participates in overload resolution if \a
\constraints \a
string is an actual array and \c Char is a compatible character
type.
@ -233,13 +230,13 @@ QT_BEGIN_NAMESPACE
\c{std::data(str)} must remain valid for the lifetime of this string view object.
This constructor only participates in overload resolution if \c Container is a
container with a compatible character type as \c{value_type}.
The string view will be empty if and only if \c{std::size(str) == 0}. It is unspecified
whether this constructor can result in a null string view (\c{std::data(str)} would
have to return \nullptr for this).
\constraints \c Container is a
container with a compatible character type as \c{value_type}.
\sa isNull(), isEmpty()
*/

View File

@ -2210,12 +2210,11 @@ QByteArray& QByteArray::append(char ch)
This function will only allocate memory if the number of elements in the
range exceeds the capacity of this byte array or this byte array is shared.
\note This function overload only participates in overload resolution if
\c InputIterator meets the requirements of a
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}.
\note The behavior is undefined if either argument is an iterator into *this or
[\a first, \a last) is not a valid range.
\constraints \c InputIterator meets the requirements of a
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}.
*/
QByteArray &QByteArray::assign(QByteArrayView v)

View File

@ -204,8 +204,7 @@
The behavior is undefined if \a len is negative or, when positive, if \a data is \nullptr.
This constructor only participates in overload resolution if \c Byte is a compatible
byte type.
\constraints \c Byte is a compatible byte type.
\sa {Compatible Byte Types}
*/
@ -224,8 +223,7 @@
The behavior is undefined if \a last precedes \a first, or \a first
is \nullptr and \a last is not.
This constructor only participates in overload resolution if \c Byte is
a compatible byte type.
\constraints \c Byte is a compatible byte type.
\sa {Compatible Byte Types}
*/
@ -240,8 +238,8 @@
Passing \nullptr as \a data is safe and results in a null byte array view.
This constructor only participates in overload resolution if \a data is not
an array and if \c Byte is a compatible byte type.
\constraints \a data is not an array and \c Byte is a
compatible byte type.
\sa {Compatible Byte Types}
*/
@ -255,8 +253,7 @@
\a data must remain valid for the lifetime of this byte array view object.
This constructor only participates in overload resolution if \c Byte is a
compatible byte type.
\constraints \c Byte is a compatible byte type.
\sa {Compatible Byte Types}
*/
@ -304,7 +301,7 @@
The container's data must remain valid for the lifetime of this byte array view object.
This constructor participates in overload resolution if \a c is any contiguous
\constraints \a c is any contiguous
container with elements of a compatible byte type.
\sa {Compatible Byte Types}

View File

@ -3376,7 +3376,10 @@ QString &QString::append(QChar ch)
resulting string, exceeds the capacity of this string, or if this string is
shared.
\note This function overload only participates in overload resolution if
\note The behavior is undefined if either argument is an iterator into *this or
[\a first, \a last) is not a valid range.
\constraints
\c InputIterator meets the requirements of a
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}
and the \c{value_type} of \c InputIterator is one of the following character types:
@ -3391,9 +3394,6 @@ QString &QString::append(QChar ch)
\li (on platforms, such as Windows, where it is a 16-bit type) \c wchar_t
\li \c char32_t
\endlist
\note The behavior is undefined if either argument is an iterator into *this or
[\a first, \a last) is not a valid range.
*/
QString &QString::assign(QAnyStringView s)

View File

@ -196,7 +196,7 @@ QT_BEGIN_NAMESPACE
The behavior is undefined if \a len is negative or, when positive, if \a str is \nullptr.
//! [compatible-char-types]
This constructor only participates in overload resolution if \c Char is a compatible
\constraints \c Char is a compatible
character type. The compatible character types are: \c QChar, \c ushort, \c char16_t and
(on platforms, such as Windows, where it is a 16-bit type) \c wchar_t.
//! [compatible-char-types]
@ -265,15 +265,15 @@ QT_BEGIN_NAMESPACE
\c{std::data(str)} must remain valid for the lifetime of this string view object.
This constructor only participates in overload resolution if \c Container is a
container with a compatible character type as \c{value_type}. The
compatible character types are: \c QChar, \c ushort, \c char16_t and
(on platforms, such as Windows, where it is a 16-bit type) \c wchar_t.
The string view will be empty if and only if \c{std::size(str) == 0}. It is unspecified
whether this constructor can result in a null string view (\c{std::data(str)} would
have to return \nullptr for this).
\constraints \c Container is a
container with a compatible character type as \c{value_type}. The
compatible character types are: \c QChar, \c ushort, \c char16_t and
(on platforms, such as Windows, where it is a 16-bit type) \c wchar_t.
\sa isNull(), isEmpty()
*/

View File

@ -235,7 +235,7 @@
The behavior is undefined if \a len is negative or, when positive, if \a str is \nullptr.
This constructor only participates in overload resolution if \c Char is a compatible
\constraints \c Char is a compatible
character type. The compatible character types are: \c char8_t, \c char, \c{signed char} and
\c{unsigned char}.
*/
@ -254,7 +254,7 @@
The behavior is undefined if \a last precedes \a first, or \a first
is \nullptr and \a last is not.
This constructor only participates in overload resolution if \c Char is a compatible
\constraints \c Char is a compatible
character type. The compatible character types are: \c char8_t, \c char, \c{signed char} and
\c{unsigned char}.
*/
@ -269,7 +269,7 @@
Passing \nullptr as \a str is safe and results in a null string view.
This constructor only participates in overload resolution if \a str
\constraints \a str
is not an array and if \c Char is a compatible character type. The
compatible character types are: \c char8_t, \c char, \c{signed char} and
\c{unsigned char}.
@ -286,7 +286,7 @@
\a string must remain valid for the lifetime of this string view
object.
This constructor only participates in overload resolution if \a string
\constraints \a string
is an actual array and if \c Char is a compatible character type. The
compatible character types are: \c char8_t, \c char, \c{signed char} and
\c{unsigned char}.
@ -301,15 +301,15 @@
\c{std::data(str)} must remain valid for the lifetime of this string view object.
This constructor only participates in overload resolution if \c Container is a
container with a compatible character type as \c{value_type}. The
compatible character types are: \c char8_t, \c char, \c{signed char} and
\c{unsigned char}.
The string view will be empty if and only if \c{std::size(str) == 0}. It is unspecified
whether this constructor can result in a null string view (\c{std::data(str)} would
have to return \nullptr for this).
\constraints \c Container is a
container with a compatible character type as \c{value_type}. The
compatible character types are: \c char8_t, \c char, \c{signed char} and
\c{unsigned char}.
\sa isNull(), isEmpty()
*/

View File

@ -1137,13 +1137,12 @@
results of type \c ContainedType initialized from the values of the
\a container.
\note This overload only participates in overload resolution if the
\c Container has input iterators.
\snippet code/src_corelib_thread_qfuture.cpp 32
\dots
\snippet code/src_corelib_thread_qfuture.cpp 34
\constraints the \c Container has input iterators.
\sa QFuture, QtFuture::makeReadyVoidFuture(),
QtFuture::makeReadyValueFuture(), QtFuture::makeExceptionalFuture()
*/

View File

@ -108,11 +108,11 @@ void QRunnable::QGenericRunnable::run()
Auto-deletion is enabled by default.
\note This function participates in overload resolution only if \c Callable
is a function or function object which can be called with zero arguments.
\note In Qt versions prior to 6.6, this method took copyable functions only.
\constraints \c Callable
is a function or function object which can be called with zero arguments.
\sa run(), autoDelete()
*/

View File

@ -512,11 +512,11 @@ void QThreadPool::start(QRunnable *runnable, int priority)
\a callableToRun is added to a run queue instead. The \a priority argument can
be used to control the run queue's order of execution.
\note This function participates in overload resolution only if \c Callable
is a function or function object which can be called with zero arguments.
\note In Qt version prior to 6.6, this function took std::function<void()>,
and therefore couldn't handle move-only callables.
\constraints \c Callable
is a function or function object which can be called with zero arguments.
*/
/*!
@ -558,11 +558,11 @@ bool QThreadPool::tryStart(QRunnable *runnable)
does nothing and returns \c false. Otherwise, \a callableToRun is run immediately
using one available thread and this function returns \c true.
\note This function participates in overload resolution only if \c Callable
is a function or function object which can be called with zero arguments.
\note In Qt version prior to 6.6, this function took std::function<void()>,
and therefore couldn't handle move-only callables.
\constraints \c Callable
is a function or function object which can be called with zero arguments.
*/
/*! \property QThreadPool::expiryTimeout
@ -820,11 +820,11 @@ void QThreadPool::startOnReservedThread(QRunnable *runnable)
Releases a thread previously reserved with reserveThread() and uses it
to run \a callableToRun.
\note This function participates in overload resolution only if \c Callable
is a function or function object which can be called with zero arguments.
\note In Qt version prior to 6.6, this function took std::function<void()>,
and therefore couldn't handle move-only callables.
\constraints \c Callable
is a function or function object which can be called with zero arguments.
*/
/*!

View File

@ -307,11 +307,11 @@
Constructs a list with the contents in the iterator range [\a first, \a last).
\note This constructor only participates in overload resolution if
The value type of \c InputIterator must be convertible to \c T.
\constraints
\c InputIterator meets the requirements of a
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}.
The value type of \c InputIterator must be convertible to \c T.
*/
/*! \fn template <typename T> QList<T>::~QList()
@ -1618,12 +1618,12 @@
This function will only allocate memory if the number of elements in the
range exceeds the capacity of this list or this list is shared.
\note This function overload only participates in overload resolution if
\c InputIterator meets the requirements of a
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}.
\note The behavior is undefined if either argument is an iterator into
*this.
\constraints
\c InputIterator meets the requirements of a
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}.
*/
/*! \fn template <typename T> QList<T>& QList<T>::assign(std::initializer_list<T> l)

View File

@ -469,8 +469,7 @@
Move-constructs a QSharedPointer instance, making it point at the same
object that \a other was pointing to.
This constructor participates in overload resolution only if \c{X*}
implicitly converts to \c{T*}.
\constraints \c{X*} implicitly converts to \c{T*}.
\since 5.6
*/
@ -480,8 +479,7 @@
Move-assigns \a other to this QSharedPointer instance.
This assignment operator participates in overload resolution only if \c{X*}
implicitly converts to \c{T*}.
\constraints \c{X*} implicitly converts to \c{T*}.
\since 5.6
*/

View File

@ -296,8 +296,7 @@
\c{[first, count)} must be a valid range.
\note This constructor participates in overload resolution only if \c{It}
is \l{span-compatible-iterators}{a compatible iterator}.
\constraints \c{It} is \l{span-compatible-iterators}{a compatible iterator}.
*/
/*!
@ -308,8 +307,7 @@
\c{[first, last)} must be a valid range.
\note This constructor participates in overload resolution only if \c{It}
is \l{span-compatible-iterators}{a compatible iterator}.
\constraints \c{It} is \l{span-compatible-iterators}{a compatible iterator}.
*/
/*!
@ -319,14 +317,14 @@
Constructs a QSpan referencing the data in the supplied array \a arr.
\note This constructor participates in overload resolution only if
\note \c{q20::type_identity_t} is a C++17 backport of C++20's
\l{https://en.cppreference.com/w/cpp/types/type_identity}{\c{std::type_identity_t}}.
\constraints
\list
\li either \c{N} or \l{extent} are \c{std::dynamic_extent} or otherwise \l{extent} \c{==} \c{N}
\li and either \c{S} or \c{const S} are the same as \c{T}.
\endlist
\note \c{q20::type_identity_t} is a C++17 backport of C++20's
\l{https://en.cppreference.com/w/cpp/types/type_identity}{\c{std::type_identity_t}}.
*/
/*!
@ -334,8 +332,7 @@
Constructs a QSpan referencing the data in the supplied range \a r.
\note This constructor participates in overload resolution only if \c{Range}
is \l{span-compatible-ranges}{a compatible range}.
\constraints \c{Range} is \l{span-compatible-ranges}{a compatible range}.
*/
/*!
@ -344,7 +341,7 @@
Constructs a QSpan referencing the data in the supplied span \a other.
\note This constructor participates in overload resolution only if
\constraints
\list
\li either \c{N} or \l{extent} are \c{std::dynamic_extent} or \l{extent} \c{==} \c{N}
\li and either \c{S} or \c{const S} are the same as \c{T}.
@ -356,12 +353,12 @@
Constructs a QSpan referencing the data in the supplied initializer list \a il.
\note This constructor participates in overload resolution only if \c{T} is \c{const}-qualified.
\note This constructor is \c{noexcept} only if \c{E} is \c{std::dynamic_extent}.
\note If \c{E} is not \c{std::dynamic_extent} and the size of \a il is not \c{E}, the behavior is undefined.
\constraints \c{T} is \c{const}-qualified.
\sa {Const and Mutable Spans}
*/
@ -742,11 +739,10 @@
If \c{E} is \c{std::dynamic_extent} then so is \c{E'}.
Otherwise, \c{E' = E * sizeof(T)}.
\note This function participates in overload resolution only if
\c{!std::is_const_v<T>}.
\note \c{q20::dynamic_extent} is a C++17 backport of C++20's
\l{https://en.cppreference.com/w/cpp/container/span/dynamic_extent}{\c{std::dynamic_extent}}.
\constraints \c{!std::is_const_v<T>}.
\sa as_bytes(), size_bytes(), {Const and Mutable Spans}
*/

View File

@ -105,11 +105,11 @@
Constructs an array with the contents in the iterator range [\a first, \a last).
This constructor only participates in overload resolution if
The value type of \c InputIterator must be convertible to \c T.
\constraints
\c InputIterator meets the requirements of an
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}.
The value type of \c InputIterator must be convertible to \c T.
*/
@ -1040,11 +1040,11 @@
range [\a first, \a last). This function will only allocate memory if the
number of elements in the range exceeds the capacity of the container.
This function overload only participates in overload resolution if
The behavior is undefined if either argument is an iterator into *this.
\constraints
\c InputIterator meets the requirements of an
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}.
The behavior is undefined if either argument is an iterator into *this.
*/
/*! \fn template <class T, qsizetype Prealloc> QVarLengthArray<T, Prealloc>& QVarLengthArray<T, Prealloc>::assign(std::initializer_list<T> list)