Nominate our 2022 Qt Champions!

Rope Data Structure

  • Does Qt provided Rope Data Structure?
    Is QString implemented using rope structure or we have to implement it.

  • Lifetime Qt Champion


    That's a question better suited for the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.

  • Thanks,
    So let's discuss this with a user scenario,
    I have a use case which contains a lot of string manipulation like insertion, deletion at random position (not only at begin or at end) as well as some standard operation like concatenation and substrings.

    If i use QString for all this, it will make a lot of copy and will also impact the performance. (QStringRef also doesn't help in all operations because it provides a thin wrapper around QString substrings and became invalid if QString is altered of which it is referencing.)

    So How to solve this problem in Qt ?

  • Lifetime Qt Champion

    It all depends on how you use your QString, the copy occurs when you modify one of the reference counted "copy" of your QString, otherwise you are modifying it directly.

    The best you can do is benchmark QString against a rope implemented string type to see which one suites your needs best

Log in to reply