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

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


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

Modified:
   MOAB/trunk/tools/ProgOptions.cpp
Log:
fix build error with clang compiler

Modified: MOAB/trunk/tools/ProgOptions.cpp
===================================================================
--- MOAB/trunk/tools/ProgOptions.cpp	2011-05-12 14:57:24 UTC (rev 4817)
+++ MOAB/trunk/tools/ProgOptions.cpp	2011-05-12 15:13:01 UTC (rev 4818)
@@ -23,7 +23,7 @@
     INT_VECT
   };
 
-  template <typename T> 
+  template <typename T> inline
   static types get_type(){ return FLAG; } //specialized for other types at bottom of this file
 
 
@@ -58,6 +58,12 @@
   friend class ProgOptions;
 };
 
+template<> ProgOpt::types ProgOpt::get_type<void>(){ return FLAG; }
+template<> ProgOpt::types ProgOpt::get_type<int>(){ return INT; }
+template<> ProgOpt::types ProgOpt::get_type<double>(){ return REAL; }
+template<> ProgOpt::types ProgOpt::get_type<std::string>(){ return STRING; }
+template<> ProgOpt::types ProgOpt::get_type< std::vector<int> >(){ return INT_VECT; }
+
 ProgOptions::ProgOptions( const std::string& helpstring ) :
     expect_optional_args(false)
 {
@@ -740,21 +746,20 @@
 /* Ensure g++ instantiates the template types we expect to use, 
    and also specialize the ProgOpt::get_type function for each supported type */
 
-#define DECLARE_OPTION_TYPE(T, PO_TYPE)                                 \
+#define DECLARE_OPTION_TYPE(T)                                 \
   template void ProgOptions::addOpt<T>( const std::string&, const std::string&, T*, int ); \
-  template bool ProgOptions::getOpt<T>( const std::string&, T* );       \
-  template<> ProgOpt::types ProgOpt::get_type<T>(){ return PO_TYPE; }
+  template bool ProgOptions::getOpt<T>( const std::string&, T* ); 
 
-#define DECLARE_VALUED_OPTION_TYPE(T, PO_TYPE)                          \
-  DECLARE_OPTION_TYPE(T, PO_TYPE)                                       \
+#define DECLARE_VALUED_OPTION_TYPE(T)                          \
+  DECLARE_OPTION_TYPE(T)                                       \
   template void ProgOptions::getOptAllArgs<T> (const std::string&, std::vector<T>& ); \
   template void ProgOptions::addRequiredArg<T>( const std::string&, const std::string&, T*, int ); \
   template void ProgOptions::addOptionalArgs<T>( unsigned, const std::string&, const std::string&, int ); \
   template T ProgOptions::getReqArg<T>( const std::string& ); \
   template void ProgOptions::getArgs<T>( const std::string&, std::vector<T>& );
  
-DECLARE_OPTION_TYPE(void, ProgOpt::FLAG)
-DECLARE_VALUED_OPTION_TYPE(int,  ProgOpt::INT)
-DECLARE_VALUED_OPTION_TYPE(double, ProgOpt::REAL)
-DECLARE_VALUED_OPTION_TYPE(std::string, ProgOpt::STRING)


More information about the moab-dev mailing list