util/StaticVector: use emplace_back() to implement push_back()
For this class, both are equal.
This commit is contained in:
parent
339b9f6e7b
commit
d5b1ca1a52
|
@ -192,19 +192,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr void push_back(const_reference value) {
|
constexpr void push_back(const_reference value) {
|
||||||
if (full())
|
emplace_back(value);
|
||||||
throw std::bad_alloc{};
|
|
||||||
|
|
||||||
::new(&array[the_size]) T(value);
|
|
||||||
++the_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr void push_back(T &&value) {
|
constexpr void push_back(T &&value) {
|
||||||
if (full())
|
emplace_back(std::move(value));
|
||||||
throw std::bad_alloc{};
|
|
||||||
|
|
||||||
::new(&array[the_size]) T(std::move(value));
|
|
||||||
++the_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
|
|
Loading…
Reference in New Issue