QArrayDataOps: improve appendIteratorRange
Handle contiguous iterators in there directly. Change-Id: I3b6d45f993f82d0de5edbfcd75856f43a7f1263b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>bb10
parent
14c5daad43
commit
507be11303
|
|
@ -911,10 +911,20 @@ public:
|
|||
Q_ASSERT(distance >= 0 && distance <= this->allocatedCapacity() - this->size);
|
||||
Q_UNUSED(distance);
|
||||
|
||||
T *iter = this->end();
|
||||
for (; b != e; ++iter, ++b) {
|
||||
new (iter) T(*b);
|
||||
++this->size;
|
||||
#if __cplusplus >= 202002L
|
||||
if constexpr (
|
||||
std::is_convertible_v<
|
||||
typename std::iterator_traits<It>::iterator_category,
|
||||
std::contiguous_iterator_tag>) {
|
||||
this->copyAppend(std::to_address(b), std::to_address(e));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
T *iter = this->end();
|
||||
for (; b != e; ++iter, ++b) {
|
||||
new (iter) T(*b);
|
||||
++this->size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue