QOffsetStringArray: fix ambiguous qOffsetStringArray overloads

There are two qOffsetStringArray overloads: one in QT_NAMESPACE, the
other in QT_PREPEND_NAMESPACE(QtPrivate). In TUs which use using
namespace QtPrivate, a call to qOffsetStringArray() may become
ambiguous.

Fix by renaming the qOffsetStringArray() to makeOffsetStringArray().

Pick-to: 6.4 6.3 6.2
Change-Id: I242a969f363e230d6a8dfb048601a0c024724f6a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2022-09-04 12:31:10 +02:00
parent 0f80b65a01
commit 21c5eeba67

View File

@ -125,7 +125,7 @@ template <size_t KL, size_t VL> struct StaticMapEntry
}; };
template <typename StringExtractor, typename... T> template <typename StringExtractor, typename... T>
constexpr auto qOffsetStringArray(StringExtractor extractString, const T &... entries) constexpr auto makeOffsetStringArray(StringExtractor extractString, const T &... entries)
{ {
constexpr size_t Count = sizeof...(T); constexpr size_t Count = sizeof...(T);
constexpr qsizetype StringLength = (sizeof(extractString(T{})) + ...); constexpr qsizetype StringLength = (sizeof(extractString(T{})) + ...);
@ -147,7 +147,7 @@ template<int ... Nx>
constexpr auto qOffsetStringArray(const char (&...strings)[Nx]) noexcept constexpr auto qOffsetStringArray(const char (&...strings)[Nx]) noexcept
{ {
auto extractString = [](const auto &s) -> decltype(auto) { return s; }; auto extractString = [](const auto &s) -> decltype(auto) { return s; };
return QtPrivate::qOffsetStringArray(extractString, QtPrivate::StaticString(strings)...); return QtPrivate::makeOffsetStringArray(extractString, QtPrivate::StaticString(strings)...);
} }
QT_WARNING_POP QT_WARNING_POP