[MOAB-dev] r4822 - MOAB/trunk/tools

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Thu May 12 10:24:13 CDT 2011


Author: kraftche
Date: 2011-05-12 10:24:13 -0500 (Thu, 12 May 2011)
New Revision: 4822

Modified:
   MOAB/trunk/tools/ProgOptions.cpp
Log:
better fix for clang build error: fail with compiler error rather than returning bogus result for unsupported types

Modified: MOAB/trunk/tools/ProgOptions.cpp
===================================================================
--- MOAB/trunk/tools/ProgOptions.cpp	2011-05-12 15:22:38 UTC (rev 4821)
+++ MOAB/trunk/tools/ProgOptions.cpp	2011-05-12 15:24:13 UTC (rev 4822)
@@ -13,23 +13,31 @@
 # include "moab_mpi.h"
 #endif
 
-class ProgOpt{
 
-  enum types{
-    FLAG = 0,
-    INT, 
-    REAL, 
-    STRING, 
-    INT_VECT
-  };
+enum OptType {
+  FLAG = 0,
+  INT, 
+  REAL, 
+  STRING, 
+  INT_VECT
+};
 
-  template <typename T> inline
-  static types get_type(){ return FLAG; } //specialized for other types at bottom of this file
 
+template <typename T> inline
+static OptType get_opt_type();
 
+
+template<> OptType get_opt_type<void             >(){ return FLAG;     }
+template<> OptType get_opt_type<int              >(){ return INT;      }
+template<> OptType get_opt_type<double           >(){ return REAL;     }
+template<> OptType get_opt_type<std::string      >(){ return STRING;   }
+template<> OptType get_opt_type<std::vector<int> >(){ return INT_VECT; }
+
+class ProgOpt{
+
   std::string shortname, longname;
   std::vector< std::string > args;
-  enum types type;
+  OptType type;
   void* storage;
   int flags;
   ProgOpt* cancel_opt;
@@ -50,20 +58,14 @@
   }
 
 public:


More information about the moab-dev mailing list