[Development] char8_t summary?
thiago.macieira at intel.com
Tue Jul 16 21:15:26 CEST 2019
On Tuesday, 16 July 2019 09:11:37 PDT Matthew Woehlke wrote:
> On 15/07/2019 18.19, Thiago Macieira wrote:
> > On Monday, 15 July 2019 09:41:24 PDT Matthew Woehlke wrote:
> >> Note also that I suggested having the template definition out-of-line;
> >> it doesn't need to be in (e.g.) qstring.h or anywhere that will affect
> >> *user* compile times. Only the TU responsible for instantiating them
> >> would be affected, and that should be negligible in the grand scheme of
> >> things.
> > Then it's no different than an overload, if the implementation isn't the
> > same (and it isn't).
> ...but a template allows the common portions to be written in a single
> definition with overloads *and/or* `if constexpr` used where the code
> needs to differ. Regular overloads would require 100% of the definition
> to be duplicated for each overload.
And what Marc and I are arguing is that the common portions are small enough
not to be worth the hassle of a template in the first place.
> Concrete example:
> // .h
> bool contains(QStringView);
> bool contains(QLatin1StringView);
1) templatisation of contains, indexOf, startsWith, etc. is already being done
2) the work being done *and* your example are UTF-16 and Latin1 only. The
whole issue here is that *UTF-8* will not share enough code.
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel System Software Products
More information about the Development