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

QIODevice: support for std::byte spans

    XMLWordPrintable

Details

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

    Description

      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);
      ```

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes