[Development] char8_t summary?

Matthew Woehlke mwoehlke.floss at gmail.com
Thu Jul 11 18:41:49 CEST 2019


On 11/07/2019 05.05, Mutz, Marc via Development wrote:
> There is a cost associated with another string class, too, and it's
> combinatorial explosion. Even when we have all view types
> (QLatin1StringView, QUtf8StringView, QStringView), consider the overload
> set of QString::replace(), ignoring the (ptr, size) variants:
> 
>    {QL1V, QU8V, QSV, QChar} x {QL1V, QU8V, QSV, QChar}
> 
> that's 16 overloads. And that's without a possible QUtf32StringView.

So?

The right way to handle this is for those methods to be templated, in
which case a) the code only needs to be written O(1) times, not O(N)
times, and b) users can potentially specialize for their own string
types as well.

If done cleverly, even the (pointer, size) variants should be able to
wrap the arguments in a View, such that those method definitions are
trivial.

-- 
Matthew


More information about the Development mailing list