BLI: support multiple parameters in Stack.push_as

This commit is contained in:
2021-04-17 19:02:30 +02:00
parent 686452fb1b
commit eff2b89446

View File

@@ -232,13 +232,14 @@ class Stack {
{
this->push_as(std::move(value));
}
template<typename ForwardT> void push_as(ForwardT &&value)
/* This is similar to std::stack::emblace. */
template<typename... ForwardT> void push_as(ForwardT &&... value)
{
if (top_ == top_chunk_->capacity_end) {
this->activate_next_chunk(1);
}
try {
new (top_) T(std::forward<ForwardT>(value));
new (top_) T(std::forward<ForwardT>(value)...);
top_++;
size_++;
}