[Interest] Why QString and not std::string?

Thiago Macieira thiago.macieira at intel.com
Fri Jun 15 14:58:22 CEST 2012


On sexta-feira, 15 de junho de 2012 16.12.55, Constantin Makshin wrote:
> On 06/15/2012 02:55 PM, Konstantin Tokarev wrote:
> > 15.06.2012, 14:50, "Rui Maciel" <rui.maciel at gmail.com>:
> >> Does anyone know what's the rationale for relying on Qt's custom QString
> >> instead of simply using C++'s standard and omnipresent std::string?
> > 
> > 1. Historical reasons - STL was not implemented on the same level in all
> > compilers in the past.
> > 2. std::string does not hadle UTF16 strings, and std::wstring is
> > non-standard
> 3. std::string's behavior (e.g. use of the copy-on-write technique) is
> implementation-dependent while QString is the same everywhere.

C++11 bans that. C++11 says that std::string must not be refcounted.

> 4. QString has more features (formatting, regular expressions, cheap
> substring extraction through QStringRef, etc.).

Any one care to give me the Standard Library equivalent of:

	QString::number(x)

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120615/c07545bd/attachment.sig>


More information about the Interest mailing list