adamdebreceni commented on a change in pull request #1259:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1259#discussion_r805785449
##########
File path: libminifi/include/core/Core.h
##########
@@ -80,13 +81,16 @@ static inline std::string getClassName() {
std::free(b);
return name;
#else
- std::string adjusted_name = typeid(T).name();
- // can probably skip class manually for slightly higher performance
- const std::string clazz = "class ";
- auto haz_clazz = adjusted_name.find(clazz);
- if (haz_clazz == 0)
- adjusted_name = adjusted_name.substr(clazz.length(),
adjusted_name.length() - clazz.length());
- return adjusted_name;
+ std::string_view name = typeid(T).name();
+ const std::string_view class_prefix = "class ";
+ const std::string_view struct_prefix = "struct ";
+
+ if (name.find(class_prefix) == 0) {
Review comment:
last time I tried to use `std::string_view::starts_with`, I recall that
some of our platforms did not support it, for now added
`StringUtils::startsWith` so we could bulk replace it as @lordgamez suggested
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]