From 5aa440fd7a5a6bff32fc628a6907e16cb6feb8a9 Mon Sep 17 00:00:00 2001 From: JiayiFeng Date: Sat, 31 Mar 2018 05:02:19 +0000 Subject: [PATCH] Add move constructor for Item --- .../operators/reader/create_double_buffer_reader_op.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc b/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc index 3f0f44924..f15747e26 100644 --- a/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc +++ b/paddle/fluid/operators/reader/create_double_buffer_reader_op.cc @@ -27,6 +27,15 @@ class DoubleBufferReader : public framework::DecoratedReader { public: struct Item { Item() : ctx_(nullptr) {} + Item(Item&& b) { + payloads_ = std::move(b.payloads_); + ctx_ = std::move(b.ctx_); + } + Item& operator=(Item&& b) { + payloads_ = std::move(b.payloads_); + ctx_ = std::move(b.ctx_); + return *this; + } std::vector payloads_; platform::DeviceContext* ctx_; -- GitLab