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



##########
File path: libminifi/include/utils/GeneralUtils.h
##########
@@ -174,6 +174,21 @@ auto invoke(F&& f, Args&&... args) 
MINIFICPP_UTIL_DEDUCED(detail::invoke_impl(st
 using std::invoke
 #endif /* < C++17 */
 
+#if __cplusplus < 201703L
+#define CPP17_INLINE
+#else
+#define CPP17_INLINE inline
+#endif /* < C++17 */
+
+namespace detail {
+struct dereference_t {
+  template<typename T>
+  T &operator()(T *ptr) const noexcept { return *ptr; }
+};
+}  // namespace detail
+
+CPP17_INLINE constexpr detail::dereference_t dereference{};

Review comment:
       the link cites performance reasons for using `inline constexpr` instead 
of `constexpr`, specifically the memory reserved in each translation unit that 
includes this header, and the per-TU initialization time, coupled with the fact 
that now we have different linkage depending on the C++ version, I would say it 
is not worth it, and would categorize this as premature optimization, I would 
be curious what others think, or possibly some other non-performance reasons




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