提交 45e5cb77 编写于 作者: W wangyunlai.wyl

fix defer\'s bug

上级 e7bf650d
...@@ -21,7 +21,7 @@ namespace common { ...@@ -21,7 +21,7 @@ namespace common {
class DeferHelper class DeferHelper
{ {
public: public:
DeferHelper(const std::function<void()> &defer) : defer_(defer) DeferHelper(const std::function<void()> defer) : defer_(std::move(defer))
{} {}
~DeferHelper() ~DeferHelper()
...@@ -30,9 +30,13 @@ public: ...@@ -30,9 +30,13 @@ public:
} }
private: private:
const std::function<void()> &defer_; const std::function<void()> defer_;
}; };
} // namespace common } // namespace common
#define DEFER(callback) common::DeferHelper defer_helper_##__LINE__(callback) #define AA(B, C) B##C
#define BB(B, C) AA(B,C)
#define DEFER(callback) common::DeferHelper BB(defer_helper_, __LINE__)(callback)
#undef AA
#undef BB
...@@ -23,4 +23,5 @@ RC FieldExpr::get_value(const Tuple &tuple, TupleCell &cell) const ...@@ -23,4 +23,5 @@ RC FieldExpr::get_value(const Tuple &tuple, TupleCell &cell) const
RC ValueExpr::get_value(const Tuple &tuple, TupleCell & cell) const RC ValueExpr::get_value(const Tuple &tuple, TupleCell & cell) const
{ {
cell = tuple_cell_; cell = tuple_cell_;
return RC::SUCCESS;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册