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

QIODevice: support for std::byte spans

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Duplicate
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • None
    • Core: I/O
    • None

      the c++20 way to work with binary data is to use std::span<std::byte> or std::span<const std::byte> (via as_bytes / as_writable_bytes), so they are a good fit for QIODevice interface.
      QTBUG-126574 had added support for readLineInto, but QIODevice could also provide overloads for read/write:
      ```
      qint64 write(QSpan<const std::byte>); // equivalent to write(const char *data, qint64 len);
      qint64 read(QSpan<std::byte>); // equivalent to read(char *data, qint64 maxlen);
      qint64 peek(QSpan<std::byte>); // equivalent to peek(char *data, qint64 maxlen);
      ```

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

            mmutz Marc Mutz
            timblechmann tim blechmann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes