[Bf-blender-cvs] [28887080a51] functions: ArrayRef constructor for SmallSet

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


Commit: 28887080a519189742c8aabeea67e0e338e86363
Author: Jacques Lucke
Date:   Wed May 22 16:41:53 2019 +0200
Branches: functions
https://developer.blender.org/rB28887080a519189742c8aabeea67e0e338e86363

ArrayRef constructor for SmallSet

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

M	source/blender/blenlib/BLI_small_set.hpp

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

diff --git a/source/blender/blenlib/BLI_small_set.hpp b/source/blender/blenlib/BLI_small_set.hpp
index aae740ac76f..82b3a4e2cd4 100644
--- a/source/blender/blenlib/BLI_small_set.hpp
+++ b/source/blender/blenlib/BLI_small_set.hpp
@@ -8,6 +8,7 @@
 
 #include "BLI_small_vector.hpp"
 #include "BLI_array_lookup.hpp"
+#include "BLI_array_ref.hpp"
 
 namespace BLI {
 
@@ -19,18 +20,19 @@ template<typename T, uint N = 4> class SmallSet {
  public:
   SmallSet() = default;
 
-  SmallSet(const SmallVector<T> &values)
+  SmallSet(ArrayRef<T> values)
   {
     for (const T &value : values) {
       this->add(value);
     }
   }
 
-  SmallSet(const std::initializer_list<T> &values)
+  SmallSet(const SmallVector<T> &values) : SmallSet(ArrayRef<T>(values))
+  {
+  }
+
+  SmallSet(const std::initializer_list<T> &values) : SmallSet(ArrayRef<T>(values))
   {
-    for (const T &value : values) {
-      this->add(value);
-    }
   }
 
   uint size() const



More information about the Bf-blender-cvs mailing list