[Development] qsizetype and classes working with QStrings or QList

Scott Bloom scott at towel42.com
Tue Aug 25 22:36:00 CEST 2020


Or

for( auto ii = 0; ii < std::vector.size(); ++ii )
{
}

since there is no suffix for "size_t" and the size of size_t will depend on 64 vs 32 bits whats the best way to AAA the index iterator?

Scott


-----Original Message-----
From: Development [mailto:development-bounces at qt-project.org] On Behalf Of André Pönitz
Sent: Tuesday, August 25, 2020 12:15
To: Mathias Hasselmann <mathias at taschenorakel.de>
Cc: development at qt-project.org
Subject: Re: [Development] qsizetype and classes working with QStrings or QList

On Mon, Aug 24, 2020 at 09:46:43AM +0200, Mathias Hasselmann wrote:
>    C++ also has a solution for that problem: [1]
>    
> https://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-al
> ways-auto/

AAA is a non-solution from the ivory tower.

It's a pain for human reviewers and tools operating on less then a full translation unit.

(Almost) real-world example:

    for (auto i = foo.guess_stuff(); --i >= 0; )
      do_something(i);

Good? Bad? 

Andre'

_______________________________________________
Development mailing list
Development at qt-project.org
https://lists.qt-project.org/listinfo/development


More information about the Development mailing list