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



##########
File path: libminifi/include/core/logging/Logger.h
##########
@@ -59,11 +59,18 @@ inline char const* conditional_conversion(const 
utils::SmallString<N>& arr) {
   return arr.c_str();
 }
 
-template<typename T>
+template<typename T, typename = typename std::enable_if<
+    std::is_arithmetic<T>::value ||
+    std::is_enum<T>::value ||
+    std::is_pointer<T>::value>::type>
 inline T conditional_conversion(T const& t) {
   return t;
 }
 
+inline char const* conditional_conversion(const char* str) {
+  return str;
+}

Review comment:
       for this comment, it is needed so we can allow 
[this](https://godbolt.org/z/9drc8f) to compile, and now that I wrote this 
down, I realize I could simply remove the `const&` qualifier on the template
   
   ```
   #include <iostream>
   
   struct A{
     static constexpr const char* STR = "abcd";
   };
   
   template<typename T, typename = typename std::enable_if<
       std::is_arithmetic<T>::value ||
       std::is_enum<T>::value ||
       std::is_pointer<T>::value>::type>
   inline T conditional_conversion(T const& t) {
     return t;
   }
   
   // inline char const* conditional_conversion(const char* str) {
   //   return str;
   // }
   
   int main(){
     std::cout << conditional_conversion(A::STR) << std::endl;
   }
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to