[Bf-blender-cvs] [66f0a125e1a] opensubdiv_compare: OpenSubdiv: Cleanup, use C++ range based loop

Sergey Sharybin noreply at git.blender.org
Mon May 25 15:46:20 CEST 2020


Commit: 66f0a125e1aedb76a443d15ab0547d05560e7436
Author: Sergey Sharybin
Date:   Tue May 19 10:53:57 2020 +0200
Branches: opensubdiv_compare
https://developer.blender.org/rB66f0a125e1aedb76a443d15ab0547d05560e7436

OpenSubdiv: Cleanup, use C++ range based loop

Avoid indirection via define.

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

M	intern/opensubdiv/internal/evaluator/evaluator_impl.cc
M	intern/opensubdiv/internal/opensubdiv_util.h

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

diff --git a/intern/opensubdiv/internal/evaluator/evaluator_impl.cc b/intern/opensubdiv/internal/evaluator/evaluator_impl.cc
index 7c80fceb51e..5216903a169 100644
--- a/intern/opensubdiv/internal/evaluator/evaluator_impl.cc
+++ b/intern/opensubdiv/internal/evaluator/evaluator_impl.cc
@@ -327,7 +327,7 @@ class VolatileEvalOutput {
     // Create evaluators for every face varying channel.
     face_varying_evaluators.reserve(all_face_varying_stencils.size());
     int face_varying_channel = 0;
-    foreach (const StencilTable *face_varying_stencils, all_face_varying_stencils) {
+    for (const StencilTable *face_varying_stencils : all_face_varying_stencils) {
       face_varying_evaluators.push_back(new FaceVaryingEval(face_varying_channel,
                                                             face_varying_stencils,
                                                             face_varying_width,
@@ -345,7 +345,7 @@ class VolatileEvalOutput {
     delete patch_table_;
     delete vertex_stencils_;
     delete varying_stencils_;
-    foreach (FaceVaryingEval *face_varying_evaluator, face_varying_evaluators) {
+    for (FaceVaryingEval *face_varying_evaluator : face_varying_evaluators) {
       delete face_varying_evaluator;
     }
   }
@@ -414,7 +414,7 @@ class VolatileEvalOutput {
     }
     // Evaluate face-varying data.
     if (hasFaceVaryingData()) {
-      foreach (FaceVaryingEval *face_varying_evaluator, face_varying_evaluators) {
+      for (FaceVaryingEval *face_varying_evaluator : face_varying_evaluators) {
         face_varying_evaluator->refine();
       }
     }
@@ -865,7 +865,7 @@ OpenSubdiv_EvaluatorImpl *openSubdiv_createEvaluatorInternal(
   // TOOD(sergey): Look into whether we've got duplicated stencils arrays.
   delete vertex_stencils;
   delete varying_stencils;
-  foreach (const StencilTable *table, all_face_varying_stencils) {
+  for (const StencilTable *table : all_face_varying_stencils) {
     delete table;
   }
   return evaluator_descr;
diff --git a/intern/opensubdiv/internal/opensubdiv_util.h b/intern/opensubdiv/internal/opensubdiv_util.h
index 3fcfdd4c32b..379ce20c479 100644
--- a/intern/opensubdiv/internal/opensubdiv_util.h
+++ b/intern/opensubdiv/internal/opensubdiv_util.h
@@ -41,8 +41,6 @@ using std::swap;
 using std::unordered_map;
 using std::vector;
 
-#define foreach(x, y) for (x : y)
-
 #define STRINGIFY_ARG(x) "" #x
 #define STRINGIFY_APPEND(a, b) "" a #b
 #define STRINGIFY(x) STRINGIFY_APPEND("", x)



More information about the Bf-blender-cvs mailing list