- 
    Bug 
- 
    Resolution: Won't Do
- 
    P2: Important 
- 
    None
- 
    6.2.5, 6.3.1, 6.4.0 Beta2
- 
    None
In Qt 5, the replace overloads
replace(int, int, const char*, int); replace(const char*, int, const char*, int);
were non-ambiguous when passing 0 as the first argument, because decltype(0) is int.
In Qt 6, the ints were changed to qsizetype, so now
replace(0, qsizetype{}, nullptr, qsizetype{});
is ambiguous, because the int could equally convert to qsizetype as to const char*.
This is particularly important, because QByteArray lacks std::string's assign(ptr, n) function which could re-use the allocated memory, unlike assigning a new QByteArray, which always allocates new memory. So we've been using
ba.replace(0, ba.size(), data, len);
in lieu of what in std::string would be
str.assign(data, len);
and run into this problem everywhere.
- relates to
- 
                    QTBUG-103531 Finish migration to qsizetype [qtbase/src/corelib/text] -         
- Closed
 
-         
- resulted from
- 
                    QTBUG-103525 Finish migration to qsizetype [qtbase/src/corelib/io] -         
- Open
 
-         
- resulted in
- 
                    QTBUG-106165 Add STL-style assign() overload sets to Qt containers. -         
- Open
 
-