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

Extending compatibility with std::basic_string<> in QString by adding support for std::string_views and std::u8string

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.14.2
    • None
    • All

    Description

      QString already has support for back and forth conversions between QString and std::u16string and std::u32string, but not std::u8string. I know UTF8 is already available through QString::fromUtf8()/toUtf8(), but the std::u8string overloads could be added for consistency (and convenience).

       

      Also, in addition to support std::basic_string<> from/to conversions, it could be nice to have std::basic_string_view<> based overloads when available (including the char8_t, char16_t and char32_t versions).

      Having the string-view overloads would allow neat constructs like adding custom string literals operators that create QStrings from utf8/16/32 string literals etc etc.

       

      I'm sure a lot of people need to inject or extract std::basic_string<> into Qt at some point, and having all the required conversions built into QString would offer a simple and convenient entry point for that. Especially now we have an almost-decent encoding support in std::basic_string<> that wouldn't break QString better defined requirements and behaviors regarding string encoding.

       

      Sorry if this has already been requested or acknowledged, or if I'm simply missing something, I couldn't find any mention of this.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            moretromain Romain Moret
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes