lordgamez commented on a change in pull request #1259:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1259#discussion_r805765567



##########
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:
       We also have a `startsWith` function in the StringUtils, maybe in the 
future in a separate jira ticket that can be removed in favor of the c++20 
variant.




-- 
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]


Reply via email to