adamdebreceni commented on a change in pull request #1168:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1168#discussion_r716655764



##########
File path: libminifi/include/utils/StringUtils.h
##########
@@ -105,6 +105,10 @@ class StringUtils {
     return s;
   }
 
+  static std::string_view trim(const std::string_view& sv);
+
+  static std::string_view trim(const char* str);

Review comment:
       you are right about the const ref, changed it to by value
   
   unfortunately we cannot remove the `const char*` overload, as if we want to 
keep the `std::string` overload, it wouldn't be able to disambiguate which 
conversion (`const char* -> std::string_view` vs `const char* -> std::string`) 
to apply
   
   removing the `std::string` overload would work, but it seems to me that we 
can freely convert a temporary `std::string` to `std::string_view` resulting in 
accidental dangling references




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