I'm wondering what the difference between the functions QList::length()
and QList::count()
really is.
The docs say:
int QList::length() const
This function is identical to count().
int QList::count(const T & value) const
Returns the number of occurrences of value in the list.
This function requires the value type to have an implementation of operator==().
But how can a function without parameters (length()
) be the same as one with parameters (count()
)? The description of the count()
-function makes sense for me.
However, what does the length()
-function exactly do? Did they mean that it is the same as the size()
-function of QList
?
int QList::length() const
is NOT equivalent to int QList::count(const T & value) const
but to int QList::count() const
(see the next signature for the count() method).
The right link: http://doc.qt.io/qt-5/qlist.html#count-1
In QList class, methods length(), size() and count() (without parameter) are equivalent and will return the same result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With