util/StaticVector: add method pop_back()
This commit is contained in:
parent
b2acf02af9
commit
a2f4fb9ddb
@ -115,10 +115,8 @@ public:
|
|||||||
/* we don't need to call any destructor */
|
/* we don't need to call any destructor */
|
||||||
the_size = 0;
|
the_size = 0;
|
||||||
} else {
|
} else {
|
||||||
while (!empty()) {
|
while (!empty())
|
||||||
back().~T();
|
pop_back();
|
||||||
--the_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,4 +205,11 @@ public:
|
|||||||
::new(&array[the_size]) T(std::forward<Args>(args)...);
|
::new(&array[the_size]) T(std::forward<Args>(args)...);
|
||||||
return *Launder(&array[the_size++]);
|
return *Launder(&array[the_size++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr void pop_back() noexcept {
|
||||||
|
assert(!empty());
|
||||||
|
|
||||||
|
back().~T();
|
||||||
|
--the_size;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user