Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5830292

Browse files
committed
fix issue BehaviorTree#34 : if you don't implement convertFromString, it will compile but it may throw
1 parent a6e4534 commit 5830292

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

include/behaviortree_cpp/basic_types.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,37 @@ T convertFromString(const StringView& /*str*/)
7272
"convertFromString for this type: ") + type_name );
7373
}
7474

75+
template <>
76+
std::string convertFromString<std::string>(const StringView& str);
77+
78+
template <>
79+
const char* convertFromString<const char*>(const StringView& str);
80+
81+
template <>
82+
int convertFromString<int>(const StringView& str);
83+
84+
template <>
85+
unsigned convertFromString<unsigned>(const StringView& str);
86+
87+
template <>
88+
double convertFromString<double>(const StringView& str);
89+
90+
template <> // Integer numbers separated by the characted ";"
91+
std::vector<int> convertFromString<std::vector<int>>(const StringView& str);
92+
93+
template <> // Real numbers separated by the characted ";"
94+
std::vector<double> convertFromString<std::vector<double>>(const StringView& str);
95+
96+
template <> // This recognizes either 0/1, true/false, TRUE/FALSE
97+
bool convertFromString<bool>(const StringView& str);
98+
99+
template <> // Names with all capital letters
100+
NodeStatus convertFromString<NodeStatus>(const StringView& str);
101+
102+
template <> // Names with all capital letters
103+
NodeType convertFromString<NodeType>(const StringView& str);
104+
105+
75106
//------------------------------------------------------------------
76107

77108
/**

0 commit comments

Comments
 (0)