[Development] Views

Marco Bubke Marco.Bubke at qt.io
Mon May 20 22:44:47 CEST 2019


On May 20, 2019 22:16:11 André Pönitz <apoenitz at t-online.de> wrote:

> On Fri, May 17, 2019 at 10:17:10AM +0200, Mutz, Marc via Development wrote:
>> [...] There is no readability difference between the use of a Qt container and
>> that of an STL container.
>
> Exhibit A:
>
>     foo().contains(x)
>
>
> Exhibit B:
>
>     {
>         ... container = foo();
>         std::find(container.begin(), container.end(), x) != container.end();
>     }

AFAIK contains is now part of the STL. But to show a pattern I see often with Qt container is the use of contains and then access the element with a key again. I that case the STL with iterators leads you to better performing code. Ranges hopefully make much of this code even more readable and performant.
>
>
>
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development



More information about the Development mailing list