Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86318

QList + QRandomGenerator are not easy to use together anymore

    XMLWordPrintable

Details

    • 21d39168170c6833512c4a5f53985272741bd7e7 (qt/qtbase/dev)

    Description

      Previously i could just do

       

      QList<Stuff> bla = something();

      Stuff randomStuff = bla.at(QRandomGenerator::global()->bounded(bla.size());

       

      and it was all nice.

       

      Now i get a complain about

       

      stress-threads-qt6.cpp:187:90: error: call of overloaded ‘bounded(qsizetype)’ is ambiguous

       

      it doesn't know whether to use 

      QRandomGenerator::bounded(double)

      or

      quint32 bounded(quint32 highest)

      or

      int QRandomGenerator::bounded(int)

       

      Is there a plan to fix this or do i have to pretend my list will never be longer tahn quint32 and cast to that?

       

      Attachments

        For Gerrit Dashboard: QTBUG-86318
        # Subject Branch Project Status CR V

        Activity

          People

            thiago Thiago Macieira
            tsdgeos Albert Astals Cid
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes