[Bf-blender-cvs] [644a915b1b0] master: BLI: don't allow mutable span of initializer list

Jacques Lucke noreply at git.blender.org
Mon Jul 13 10:51:55 CEST 2020


Commit: 644a915b1b096be816ddc50050a70d90a2787191
Author: Jacques Lucke
Date:   Mon Jul 13 10:49:59 2020 +0200
Branches: master
https://developer.blender.org/rB644a915b1b096be816ddc50050a70d90a2787191

BLI: don't allow mutable span of initializer list

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

M	source/blender/blenlib/BLI_span.hh

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

diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh
index 5c841787520..57ef9ce9eb6 100644
--- a/source/blender/blenlib/BLI_span.hh
+++ b/source/blender/blenlib/BLI_span.hh
@@ -440,21 +440,6 @@ template<typename T> class MutableSpan {
   {
   }
 
-  /**
-   * Reference an initializer_list. Note that the data in the initializer_list is only valid until
-   * the expression containing it is fully computed.
-   *
-   * Do:
-   *  call_function_with_array({1, 2, 3, 4});
-   *
-   * Don't:
-   *  MutableSpan<int> span = {1, 2, 3, 4};
-   *  call_function_with_array(span);
-   */
-  MutableSpan(std::initializer_list<T> &list) : MutableSpan(list.begin(), list.size())
-  {
-  }
-
   MutableSpan(std::vector<T> &vector) : MutableSpan(vector.data(), vector.size())
   {
   }



More information about the Bf-blender-cvs mailing list