[Bf-blender-cvs] [d5e675bddbf] functions: append rvalue reference to smallvector

Jacques Lucke noreply at git.blender.org
Sun Feb 10 20:26:20 CET 2019


Commit: d5e675bddbf3619b6f4c9a44dd2d9caba2c8b521
Author: Jacques Lucke
Date:   Thu Feb 7 13:51:47 2019 +0100
Branches: functions
https://developer.blender.org/rBd5e675bddbf3619b6f4c9a44dd2d9caba2c8b521

append rvalue reference to smallvector

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

M	source/blender/blenlib/BLI_small_vector.hpp

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

diff --git a/source/blender/blenlib/BLI_small_vector.hpp b/source/blender/blenlib/BLI_small_vector.hpp
index 874c8857c52..a7041952d46 100644
--- a/source/blender/blenlib/BLI_small_vector.hpp
+++ b/source/blender/blenlib/BLI_small_vector.hpp
@@ -88,6 +88,16 @@ namespace BLI {
 			this->m_size++;
 		}
 
+		void append(T &&value)
+		{
+			this->ensure_space_for_one();
+			std::uninitialized_copy(
+				std::make_move_iterator(&value),
+				std::make_move_iterator(&value + 1),
+				this->end());
+			this->m_size++;
+		}
+
 		void fill(const T &value)
 		{
 			for (uint i = 0; i < this->m_size; i++) {



More information about the Bf-blender-cvs mailing list