HappenLee commented on a change in pull request #5706:
URL: https://github.com/apache/incubator-doris/pull/5706#discussion_r619948802



##########
File path: be/src/util/defer_op.h
##########
@@ -34,6 +34,24 @@ class DeferOp {
     DeferFunction _func;
 };
 
+// A Better Defer operator #5576
+// for C++17
+// Defer defer {[]{ call something }};
+//
+// for C++11
+// auto op = [] {};
+// Defer<decltype<op>> (op);
+template <class T>
+class Defer {
+public:
+    Defer(T& closure) : _closure(closure) {}

Review comment:
       may only Defer(T&& closure) : _clousure(std::forward<T>(closure)) is 
better




-- 
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to