- Timestamp:
- May 19, 2006, 3:29:21 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/executor/executor_functional.h
r7719 r7720 39 39 template<> float fromString<float>(const std::string& input, float defaultValue) { return isFloat(input, defaultValue); }; 40 40 template<> char fromString<char>(const std::string& input, char defaultValue) { return isInt(input, defaultValue); }; 41 template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { return isString(input, defaultValue); };41 template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { static std::string retVal = isString(input, defaultValue); return retVal; }; 42 42 43 43 template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; }; … … 47 47 template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getFloat(); }; 48 48 template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getChar(); }; 49 template<> std::string getDefault<std::string>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getString(); };49 template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { static std::string retVal = defaultValues[i].getString(); return retVal; }; 50 50 51 51 #endif /* __EXECUTOR_FUNCTIONAL_H_ */ -
trunk/src/orxonox.cc
r7718 r7720 431 431 void printTestBool(bool b) { printf("%d\n", (int)b); }; 432 432 void printTwoVals(int b, int i) { printf ("%d %d\n", b, i); }; 433 433 void printStrings(const std::string& name) { printf("String:: '%s'\n", name.c_str()); }; 434 434 static void printStatic() { printf("STATIC\n");}; 435 435 }; … … 444 444 (*createExecutor<TestClass>(&TestClass::printTwoVals))(&test, testStrings); 445 445 (*createExecutor<TestClass>(&TestClass::printStatic))(&test, testStrings); 446 (*createExecutor<TestClass>(&TestClass::printStrings))(&test, testStrings); 446 447 447 448 }
Note: See TracChangeset
for help on using the changeset viewer.