[Bf-blender-cvs] [23b1872d6e4] master: Cleanup: Replace std::vector with blender::Vector.

Jeroen Bakker noreply at git.blender.org
Fri Mar 26 16:03:40 CET 2021


Commit: 23b1872d6e45fd40aaf5040c1553bfbd524e0a11
Author: Jeroen Bakker
Date:   Fri Mar 26 11:55:13 2021 +0100
Branches: master
https://developer.blender.org/rB23b1872d6e45fd40aaf5040c1553bfbd524e0a11

Cleanup: Replace std::vector with blender::Vector.

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

M	source/blender/compositor/intern/COM_NodeGraph.cc
M	source/blender/compositor/intern/COM_NodeGraph.h
M	source/blender/compositor/intern/COM_NodeOperationBuilder.cc

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

diff --git a/source/blender/compositor/intern/COM_NodeGraph.cc b/source/blender/compositor/intern/COM_NodeGraph.cc
index d8220099f1f..3bed9cdac03 100644
--- a/source/blender/compositor/intern/COM_NodeGraph.cc
+++ b/source/blender/compositor/intern/COM_NodeGraph.cc
@@ -83,7 +83,7 @@ void NodeGraph::add_node(Node *node,
   node->setInstanceKey(key);
   node->setIsInActiveGroup(is_active_group);
 
-  m_nodes.push_back(node);
+  m_nodes.append(node);
 
   DebugInfo::node_added(node);
 }
@@ -156,7 +156,7 @@ void NodeGraph::add_bNode(const CompositorContext &context,
 NodeGraph::NodeInputs NodeGraph::find_inputs(const NodeRange &node_range, bNodeSocket *b_socket)
 {
   NodeInputs result;
-  for (NodeGraph::NodeIterator it = node_range.first; it != node_range.second; ++it) {
+  for (blender::Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) {
     Node *node = *it;
     for (int index = 0; index < node->getNumberOfInputSockets(); index++) {
       NodeInput *input = node->getInputSocket(index);
@@ -170,7 +170,7 @@ NodeGraph::NodeInputs NodeGraph::find_inputs(const NodeRange &node_range, bNodeS
 
 NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_socket)
 {
-  for (NodeGraph::NodeIterator it = node_range.first; it != node_range.second; ++it) {
+  for (blender::Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) {
     Node *node = *it;
     for (int index = 0; index < node->getNumberOfOutputSockets(); index++) {
       NodeOutput *output = node->getOutputSocket(index);
diff --git a/source/blender/compositor/intern/COM_NodeGraph.h b/source/blender/compositor/intern/COM_NodeGraph.h
index 990e3a30831..7533c6915e7 100644
--- a/source/blender/compositor/intern/COM_NodeGraph.h
+++ b/source/blender/compositor/intern/COM_NodeGraph.h
@@ -22,7 +22,6 @@
 
 #include <map>
 #include <set>
-#include <vector>
 
 #include "DNA_node_types.h"
 
@@ -50,18 +49,15 @@ class NodeGraph {
     }
   };
 
-  typedef std::vector<Node *> Nodes;
-  typedef Nodes::iterator NodeIterator;
-
  private:
-  Nodes m_nodes;
+  blender::Vector<Node *> m_nodes;
   blender::Vector<Link> m_links;
 
  public:
   NodeGraph();
   ~NodeGraph();
 
-  const Nodes &nodes() const
+  const blender::Vector<Node *> &nodes() const
   {
     return m_nodes;
   }
@@ -73,7 +69,8 @@ class NodeGraph {
   void from_bNodeTree(const CompositorContext &context, bNodeTree *tree);
 
  protected:
-  typedef std::pair<NodeIterator, NodeIterator> NodeRange;
+  typedef std::pair<blender::Vector<Node *>::iterator, blender::Vector<Node *>::iterator>
+      NodeRange;
   typedef std::vector<NodeInput *> NodeInputs;
 
   static bNodeSocket *find_b_node_input(bNode *b_node, const char *identifier);
diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
index 1c741283c7b..da9cadd05b6 100644
--- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
+++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc
@@ -53,9 +53,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system)
   /* interface handle for nodes */
   NodeConverter converter(this);
 
-  for (int index = 0; index < m_graph.nodes().size(); index++) {
-    Node *node = (Node *)m_graph.nodes()[index];
-
+  for (Node *node : m_graph.nodes()) {
     m_current_node = node;
 
     DebugInfo::node_to_operations(node);



More information about the Bf-blender-cvs mailing list