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

Error in documentation for QBitArray::fill

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.0 Beta
    • 5.3.0
    • Documentation
    • 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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            treinio Topi Reiniƶ
            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