← Back to team overview

kicad-developers team mailing list archive

[PATCH 09/11] Use const int instead of anonymous enum type

 

These values are used in a context where the implicit conversion to integer
is necessary, but creates ambiguous template resolutions that MSVC 9 cannot
resolve. As these constants are not actually an enumerated type, simply
declaring them as static members avoids the problem.
---
 include/geometry/rtree.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/geometry/rtree.h b/include/geometry/rtree.h
index 35ccadb..b678d25 100644
--- a/include/geometry/rtree.h
+++ b/include/geometry/rtree.h
@@ -85,10 +85,8 @@ public:
 
     // These constant must be declared after Branch and before Node struct
     // Stuck up here for MSVC 6 compiler.  NSVC .NET 2003 is much happier.
-    enum {
-        MAXNODES = TMAXNODES,                       ///< Max elements in node
-        MINNODES = TMINNODES,                       ///< Min elements in node
-    };
+    static const int MAXNODES = TMAXNODES;          ///< Max elements in node
+    static const int MINNODES = TMINNODES;          ///< Min elements in node
 
     struct Statistics {
         int maxDepth;

Follow ups

References