[Bf-blender-cvs] [eff2b894464] master: BLI: support multiple parameters in Stack.push_as

Jacques Lucke noreply at git.blender.org
Sat Apr 17 19:09:34 CEST 2021


Commit: eff2b894464caa83550bcc72d75e3427dfcb4ceb
Author: Jacques Lucke
Date:   Sat Apr 17 19:02:30 2021 +0200
Branches: master
https://developer.blender.org/rBeff2b894464caa83550bcc72d75e3427dfcb4ceb

BLI: support multiple parameters in Stack.push_as

===================================================================

M	source/blender/blenlib/BLI_stack.hh

===================================================================

diff --git a/source/blender/blenlib/BLI_stack.hh b/source/blender/blenlib/BLI_stack.hh
index 19f77078c5b..c20a9b9ecfa 100644
--- a/source/blender/blenlib/BLI_stack.hh
+++ b/source/blender/blenlib/BLI_stack.hh
@@ -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_++;
     }



More information about the Bf-blender-cvs mailing list