summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydata.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-08-29 12:09:32 -0700
committerThiago Macieira <thiago.macieira@intel.com>2024-08-30 10:13:07 -0700
commit6306ebe749e083126a39b9dd13d7060aa7bdacc2 (patch)
treef471e1bec3106af925c7c74a276d5c354f985097 /src/corelib/tools/qarraydata.h
parentf02402044e552f2940d4677039f3d02c41eb27ee (diff)
Containers: add a static constexpr maxSize()
max_size() will be made non-static to strictly follow the C++ Standard Library concept, but it makes no sense for the Qt containers to have allocations limited per instance, as they are not allocator-aware. This commit adds a Qt-style camelCase() function to the STL-style snake_case() with the semantics we want. Pick-to: 6.8 Task-number: QTBUG-128450 Change-Id: I2e4aa228c71c821c01bafc0f37956d29fe652ef1 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r--src/corelib/tools/qarraydata.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index da83fc1a21a..38d1091ac1f 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -171,11 +171,15 @@ struct QTypedArrayData
return static_cast<T *>(start);
}
- constexpr static qsizetype max_size() noexcept
+ constexpr static qsizetype maxSize() noexcept
{
// -1 to deal with the pointer one-past-the-end
return (QtPrivate::MaxAllocSize - sizeof(QtPrivate::AlignedQArrayData) - 1) / sizeof(T);
}
+ constexpr static qsizetype max_size() noexcept
+ {
+ return maxSize();
+ }
};
namespace QtPrivate {