[Development] User-defined literals for QString (and QByteArray)
andrei.golubev at qt.io
Fri Mar 5 10:55:30 CET 2021
For anyone interested, here's a patch:
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 ) maybe there should be a richer hierarchy? For example,
> "QtLiterals::StringLiterals", so that the suffix could be reused without
> conflicts, etc.
> * 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...
More information about the Development