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

Add QtContainer::usize(), returning size() unsigned

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • None
    • 19aa5da9b (dev)

    Description

      The following code can produce a warning:

      QList<Bar> entries;
      
      std::vector<Foo> values;
      
      values.reserve(entries.size()); // warning
      

      You can silence the warning with:

      QList<Bar> entries;
      
      std::vector<Foo> values;
      
      values.reserve(static_cast<std::size_t>(entries.size())); // no warning but very verbose
      

      Adding usize() to Qt Container would improve the readability of the code:

      QList<Bar> entries;
      
      std::vector<Foo> values;
      
      values.reserve(entries.usize()); // warning
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            bubke Marco Bubke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: