Expand if condition for readability
Change-Id: I5057c236457587ad03b55019cb340cf59d9ecdb5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
5a92bc9760
commit
2c52e9a5c1
@ -139,16 +139,23 @@ public:
|
|||||||
|
|
||||||
void reserve(size_t n)
|
void reserve(size_t n)
|
||||||
{
|
{
|
||||||
if (n > capacity()
|
if (n == 0)
|
||||||
|| (n
|
return;
|
||||||
&& !d->capacityReserved
|
|
||||||
&& (d->ref.isShared() || (d->capacityReserved = 1, false)))) {
|
if (n <= capacity()) {
|
||||||
|
if (d->capacityReserved)
|
||||||
|
return;
|
||||||
|
if (!d->ref.isShared()) {
|
||||||
|
d->capacityReserved = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SimpleVector detached(Data::allocate(n,
|
SimpleVector detached(Data::allocate(n,
|
||||||
d->detachFlags() | Data::CapacityReserved));
|
d->detachFlags() | Data::CapacityReserved));
|
||||||
detached.d->copyAppend(constBegin(), constEnd());
|
detached.d->copyAppend(constBegin(), constEnd());
|
||||||
detached.swap(*this);
|
detached.swap(*this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void prepend(const_iterator first, const_iterator last)
|
void prepend(const_iterator first, const_iterator last)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user