szaszm commented on a change in pull request #875:
URL: https://github.com/apache/nifi-minifi-cpp/pull/875#discussion_r478528737



##########
File path: libminifi/include/utils/OptionalUtils.h
##########
@@ -37,11 +39,47 @@ optional<typename gsl_lite::remove_cvref<T>::type> 
optional_from_ptr(T&& obj) {
   return obj == nullptr ? nullopt : optional<typename 
gsl_lite::remove_cvref<T>::type>{ std::forward<T>(obj) };
 }
 
+template<typename>
+struct is_optional : std::false_type {};
+
+template<typename T>
+struct is_optional<optional<T>> : std::true_type {};
+
 }  // namespace utils
 }  // namespace minifi
 }  // namespace nifi
 }  // namespace apache
 }  // namespace org
 
+namespace nonstd {
+namespace optional_lite {
+
+namespace minifiutils = org::apache::nifi::minifi::utils;
+
+// map
+template<typename SourceType, typename F>
+auto operator|(const optional<SourceType>& o, F&& f) 
noexcept(noexcept(minifiutils::invoke(std::forward<F>(f), *o)))
+    -> optional<typename 
std::decay<decltype(minifiutils::invoke(std::forward<F>(f), *o))>::type> {
+  if (o.has_value()) {
+    return make_optional(minifiutils::invoke(std::forward<F>(f), *o));
+  } else {
+    return nullopt;
+  }
+}
+
+// bind
+template<typename SourceType, typename F>
+auto operator>>=(const optional<SourceType>& o, F&& f) 
noexcept(noexcept(minifiutils::invoke(std::forward<F>(f), *o)))

Review comment:
       fixed in 13116f0 and fdcec88




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