Results 1 to 10 of 10

Thread: using QStringRef

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2011
    Posts
    354
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows
    Thanks
    17
    Thanked 27 Times in 24 Posts

    Default Re: using QStringRef

    yes, but it is boring to create a new function when there is exactly what you need in QString. And yes, in this case it is not very painful, but still it is extra and when used intensively it slows down processing. If QStringRef just had a pointer to a part of the initial string, everything would be ok.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: using QStringRef

    It can't have a pointer to a part of the initial string because such thing doesn't exist. QStringRef is the closest you can get to "a part of the initial string". Remember that nobody forces you to use QString. If you only have ascii data, you can use QByteArray. This won't change much as most C functions require the string to end with \0 and there is no \0 in the middle of a string so you'll have to make a copy anyway.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.