That’s why in Qbs we have «stlutils» header [0]
I think, I already proposed in one of the similar Qt vs std threads an addition
of free functions to make life easier with std:: containers. As far as I
remember, Thiago’s main argument against using std::vector was that .empty()
looks ugly (and I completely agree with that!).
However, instead of adding
template<class T> bool qIsEmpty(const T &t) { return t.empty(); }
we keep discussing how ugly std is=)
PS: note, that there is std::empty [1] (which can be used with c-arrays as
well) in the standard library, so, again, Qt kind of misses feature parity here
[0] https://github.com/qbs/qbs/blob/master/src/lib/corelib/tools/stlutils.h
<https://github.com/qbs/qbs/blob/master/src/lib/corelib/tools/stlutils.h>
[1] https://en.cppreference.com/w/cpp/iterator/empty
<https://en.cppreference.com/w/cpp/iterator/empty>
> 24 дек. 2019 г., в 12:12, Kevin Kofler <[email protected]> написал(а):
>
> Иван Комиссаров wrote:
>> Well, every time I use (or try to use) QStringView I encounter the problem
>> of missing methods/functionality. The same applies to the Qt containers.
>
> It's funny because I have that issue each time I am forced to work with
> somebody else's STL containers. :-) (Sometimes, <algorithms> can help, e.g.,
> to find an element in an std::vector, but its arcane syntax with the pair of
> iterators is a pain compared to just calling a method such as
> QVector::contains.)
>
> Kevin Kofler
>
> _______________________________________________
> Development mailing list
> [email protected]
> https://lists.qt-project.org/listinfo/development
_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development