summaryrefslogtreecommitdiff
path: root/src/base/str.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/str.hh')
-rw-r--r--src/base/str.hh11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/base/str.hh b/src/base/str.hh
index 52ab977fc..61022bd26 100644
--- a/src/base/str.hh
+++ b/src/base/str.hh
@@ -1,4 +1,7 @@
/*
+ * Copyright (c) 2018 ARM Limited
+ * All rights reserved
+ *
* Copyright (c) 2001-2005 The Regents of The University of Michigan
* All rights reserved.
*
@@ -102,10 +105,11 @@ tokenize(std::vector<std::string> &vector, const std::string &s,
* @{
*
* @name String to number helper functions for signed and unsigned
- * integeral type, as well as floating-point types.
+ * integeral type, as well as enums and floating-point types.
*/
template <class T>
-typename std::enable_if<std::is_integral<T>::value &&
+typename std::enable_if<(std::is_integral<T>::value ||
+ std::is_enum<T>::value) &&
std::is_signed<T>::value, T>::type
__to_number(const std::string &value)
{
@@ -117,7 +121,8 @@ __to_number(const std::string &value)
}
template <class T>
-typename std::enable_if<std::is_integral<T>::value &&
+typename std::enable_if<(std::is_integral<T>::value ||
+ std::is_enum<T>::value) &&
!std::is_signed<T>::value, T>::type
__to_number(const std::string &value)
{