Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/36279 )
Change subject: base: Narrow the applicability of the default to_number.
......................................................................
base: Narrow the applicability of the default to_number.
That template only works for integral (except bool), floating point,
or enum types, so restrict it to those types. That makes it easier to
detect what types will work with that function.
Change-Id: Ib29a9a0ea75dd617e28bb6850d60be905f93182f
---
M src/base/str.hh
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/base/str.hh b/src/base/str.hh
index 5e56e62..c19dfa1 100644
--- a/src/base/str.hh
+++ b/src/base/str.hh
@@ -164,7 +164,10 @@
* @return True if the parsing was successful
*/
template <class T>
-inline bool
+inline std::enable_if_t<(std::is_integral<T>::value ||
+ std::is_floating_point<T>::value ||
+ std::is_enum<T>::value) &&
+ !std::is_same<bool, T>::value, bool>
to_number(const std::string &value, T &retval)
{
try {
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36279
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ib29a9a0ea75dd617e28bb6850d60be905f93182f
Gerrit-Change-Number: 36279
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s