[Development] User-defined literals for QString (and QByteArray)

Andrei Golubev andrei.golubev at qt.io
Fri Mar 5 10:55:30 CET 2021

For anyone interested, here's a patch:

Best Regards,
From: Development <development-bounces at qt-project.org> on behalf of Thiago Macieira <thiago.macieira at intel.com>
Sent: Wednesday, March 3, 2021 8:58 PM
To: development at qt-project.org <development at qt-project.org>
Subject: Re: [Development] User-defined literals for QString (and QByteArray)

On Wednesday, 3 March 2021 07:53:25 PST Andrei Golubev wrote:
> This is the proposal in a nutshell. I'd like to have some feedback and then
> some suggestions regarding:
>   *   Whether we want this for QByteArray as well (similarly to QString it
> allows "from raw data" construction, but then it's not really a string
> class, is it?)

I don't think it's necessary. That doesn't happen often enough and when it
does, fromRawData is probably enough.

>   *   What suffix to use: in the example above I used "_q", but maybe "_qs"
>   is better or something totally different

I think _qs.

>  *   How to call a namespace: I'd probably go with "QtLiterals" but (looking
>  at [2]) maybe there should be a richer hierarchy? For example,
>  "QtLiterals::StringLiterals", so that the suffix could be reused without
>  conflicts, etc.

No preference.

>   *   Whether *View classes need it (in theory they should allow implicit
>   construction, so probably not)

No, they don't, since you can already construct them without too much typing.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering

Development mailing list
Development at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20210305/ecf04fb4/attachment-0001.html>

More information about the Development mailing list