mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Merge pull request #995 from nogitsune-youkai/StackVectorExceptionsCppCompliance
Fix: Make clear and pop_back noexcept compliant
This commit is contained in:
commit
df057507e9
1 changed files with 4 additions and 6 deletions
|
|
@ -69,16 +69,14 @@ namespace util {
|
||||||
++size_;
|
++size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pop_back() {
|
void pop_back() noexcept {
|
||||||
if (size_ > 0) {
|
if (size_ > 0) {
|
||||||
data_.ptr()[size_ - 1].~T();
|
data_.ptr()[size_ - 1].~T();
|
||||||
--size_;
|
--size_;
|
||||||
} else {
|
|
||||||
throw std::underflow_error("stack vector is empty");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() noexcept {
|
||||||
for (int i = 0; i < size_; ++i) {
|
for (int i = 0; i < size_; ++i) {
|
||||||
data_.ptr()[i].~T();
|
data_.ptr()[i].~T();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue