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

Error in documentation for QBitArray::fill

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.3.0
    • Fix Version/s: 5.4.0 Beta
    • Component/s: Documentation
    • Labels:
      None

      Description

      The documentation for QBitArray::fill states:

      Sets bits at index positions begin up to and excluding end to value.

      begin and end must be a valid index position in the bit array (i.e., 0 <= begin <= size() and 0 <= end <= size()).

      However, this is not entirely correct. Since this method excludes the end value, to set the last bit in the array end must be set to size(). begin is restricted to 0 <= begin <= size(), but end is restricted to 0 <= end < size().

      For example:

      QBitArray a(4);
      a.fill(true, 1, 2); // a: [ 0, 1, 0, 0 ]
      a.fill(true, 1, 3); // a: [ 0, 1, 1, 0 ]
      a.fill(true, 1, 4); // a: [ 0, 1, 1, 1 ]
      

        Attachments

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

          Activity

            People

            Assignee:
            treinio Topi Reiniƶ
            Reporter:
            richgriswold Richard Griswold
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes