
Qt, range-based for loops and structured bindings - jcelerier
https://www.kdab.com/qt-range-based-for-loops-and-structured-bindings/
======
eska
At my previous job I created wrappers around QSqlQuery that don't work with
string keys in operator[] and instead used template argument pack
decomposition. So given a function

    
    
      DbResultIterator<int, QString> getUserNames()
    

I could do something like this:

    
    
      for(auto [id, name] : db.getUserIdsAndNames()) {
           // id and name are type-safe int and QString
      }
      vector<QString> v;
      ranges::transform(db.getUserIdsAndNames(), [](int id, const QString& name) {
          return name.toUpper()
      }, back_inserter(v));
    

Internally the iterator would wrap QSqlResult and decompose the template
argument pack, calling specialized functions such as

    
    
      result.data(0).toString()
    

knowing the index and type due to the definition of DbResultIterator<...>.

Unfortunately I cannot share the code here because of copyright, but I can
recommend it.

------
GnarfGnarf
These issues have not been a problem for me, converting 500KLOC codebase with
lots of STL from Win32 to Qt.

------
choward
This site immediately popped up the worst cookies prompt I've seen in my life.
Couldn't even read what the green buttons said without straining my eyes so I
just closed the dab.

~~~
radarsat1
I'm using the "I don't care about cookies" Firefox plugin and didn't notice a
thing. Frankly, the GDPR is such a shit-show it's the only way I can use the
web now.

~~~
cannam
The industry response to GDPR is continually fascinating.

The idea of the GDPR was, presumably, to suggest that publishers and other
industry actors might like to change their ways. If they were to keep doing
what they had been doing, in terms of personal data collection and sharing, it
would require such specific and explicit opt-ins for every single reader that
no publisher would think it was a worthwhile tradeoff any more.

But the choice of the publishers has been to do that - to place those specific
and explicit opt-ins in front of their readers, to offload to their readers
the hard work of changing their ways instead of changing them themselves.

~~~
eska
Personally I'm amazed that there still are so many websites with opt-out
policies, which are illegal according to GDPR.

~~~
raverbashing
They love to repeat the crap about how gdpr fines are in the millions while
making sure to barely "comply" with the law. Or just pretend to comply at
least.

Just remember that following the letter and not the spirit of the law usually
only flies in the US

~~~
bmn__
Report offenders to ankle-biters like [https://noyb.eu](https://noyb.eu)

