[Base] Add generic implementation for converting from string to T, and add specific implementation for string to bool

This commit is contained in:
Jonathan Goyvaerts 2019-04-17 21:50:25 +02:00
parent 950e53779c
commit bc6c047152
1 changed files with 9 additions and 1 deletions

View File

@ -85,7 +85,15 @@ inline std::string to_string(const __m128& value) {
#endif
template <typename T>
inline T from_string(const char* value, bool force_hex = false);
inline T from_string(const char* value, bool force_hex = false) {
// Missing implementation for converting type T to string
throw;
}
template <>
inline bool from_string<bool>(const char* value, bool force_hex) {
return std::strcmp(value, "true") == 0 || value[0] == '1';
}
template <>
inline int32_t from_string<int32_t>(const char* value, bool force_hex) {