[Bf-blender-cvs] [d5b707b6fbf] functions: improve SmallStack class

Jacques Lucke noreply at git.blender.org
Wed May 22 17:32:33 CEST 2019


Commit: d5b707b6fbf52846ea6a8903a40612d21a1e2661
Author: Jacques Lucke
Date:   Wed May 22 16:22:47 2019 +0200
Branches: functions
https://developer.blender.org/rBd5b707b6fbf52846ea6a8903a40612d21a1e2661

improve SmallStack class

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

M	source/blender/blenlib/BLI_small_stack.hpp

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

diff --git a/source/blender/blenlib/BLI_small_stack.hpp b/source/blender/blenlib/BLI_small_stack.hpp
index 5872a12ccfd..60a3713c0b6 100644
--- a/source/blender/blenlib/BLI_small_stack.hpp
+++ b/source/blender/blenlib/BLI_small_stack.hpp
@@ -25,17 +25,19 @@ template<typename T, uint N = 4> class SmallStack {
     return this->size() == 0;
   }
 
-  void push(T value)
+  void push(const T &value)
   {
     m_elements.append(value);
   }
 
+  void push(T &&value)
+  {
+    m_elements.append(std::forward<T>(value));
+  }
+
   T pop()
   {
-    BLI_assert(!this->empty());
-    T value = m_elements[this->size() - 1];
-    m_elements.remove_last();
-    return value;
+    return m_elements.pop_last();
   }
 
   T &peek()



More information about the Bf-blender-cvs mailing list