rsx: Use emplace when constructing in-place.

- Unexpectedly high gains for msvc builds. GCC doesn't care, clang shits itself.
This commit is contained in:
kd-11 2023-02-27 21:51:22 +03:00 committed by kd-11
parent 1b8a69154f
commit 0bb8127372
2 changed files with 17 additions and 9 deletions

View file

@ -138,6 +138,17 @@ namespace rsx
_data[_size++] = val;
}
template <typename... Args>
void emplace_back(Args&&... args)
{
if (_size >= _capacity)
{
reserve(_capacity + 16);
}
std::construct_at(&_data[_size++], std::forward<Args&&>(args)...);
}
Ty pop_back()
{
return _data[--_size];