mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
C++: optimize SharedVector's iterator constructor
Don't detach for every element. Closes #2737
This commit is contained in:
parent
adcb55fd18
commit
422bcc3a4a
2 changed files with 6 additions and 3 deletions
|
@ -60,9 +60,8 @@ struct SharedVector
|
|||
SharedVector(InputIt first, InputIt last)
|
||||
: SharedVector(SharedVector::with_capacity(std::distance(first, last)))
|
||||
{
|
||||
for (auto it = first; it != last; ++it) {
|
||||
push_back(*it);
|
||||
}
|
||||
std::uninitialized_copy(first, last, begin());
|
||||
inner->size = inner->capacity;
|
||||
}
|
||||
|
||||
/// Creates a new vector that is a copy of \a other.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue