[Development] Use of Standard Library containers in Qt source code

Thiago Macieira thiago.macieira at intel.com
Sat Jul 2 19:10:11 CEST 2016


On sábado, 2 de julho de 2016 15:44:50 PDT Mark Gaiser wrote:
> I don't get why you would be confused by - for instance - the empty
> method.
> STL has that method, but so does Qt [1] apparently in an attempt to be
> compatible with the STL API.

That doesn't mean we will allow the use of those methods in our own libraries. 
I *will* reject any code that uses empty() to mean isEmpty() on a Qt 
container.

The whole point of this thread is that using certain methods is misleading or, 
at best, confusing.

> Even if you don't want to learn or know how the STL API looks like, it
> should not matter since the very same members also apply on Qt containers
> with the same .
> This is the case for all your examples in Option 3.
> 
> Imho it would be nice - when using Qt and STL containers in the same
> statement - to use common functions that mean the same in both API's. Thus
> in your example both should have been empty() calls, even on the Qt
> container to be consistent. But that's just my opinion :)

I agree with your premise and the benefits in your conclusion. I just don't 
agree with using the Standard Library names, in detriment to Qt's own API. 

The whole point of Option 3 is to provide the Qt-like names so that we have 
*only* Qt-like names in Qt's source code. We'd achieve the same as you 
proposed (consistency) and we'd be consistent with the rest of the existing 
code as well as our recommended API.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list