QList sliced vs mid and what are sublists?
-
The methods sliced and mid of QList look quite similar. Are there any differences?
The documentation also calls the return value a sub-list. What exactly is that?
I was looking at it because I wanted to "slice off" some elements off of a list as in:data = data.slice(from, to);without using the iterator constructors:
data = QList{ data.begin() + from, data.end() + to }; -
The methods sliced and mid of QList look quite similar. Are there any differences?
The documentation also calls the return value a sub-list. What exactly is that?
I was looking at it because I wanted to "slice off" some elements off of a list as in:data = data.slice(from, to);without using the iterator constructors:
data = QList{ data.begin() + from, data.end() + to };There is no difference, sliced() was only added because "This keeps the API symmetric with what we have in our string classes.": https://codereview.qt-project.org/c/qt/qtbase/+/305959
-
G gozag has marked this topic as solved on