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



##########
File path: extensions/standard-processors/processors/GenerateFlowFile.h
##########
@@ -67,16 +67,14 @@ class GenerateFlowFile : public core::Processor {
   // Nest Callback Class for write stream
   class WriteCallback : public OutputStreamCallback {
    public:
-    WriteCallback(std::vector<char> && data) : data_(std::move(data)) { // 
NOLINT
-    }
-    WriteCallback(const std::vector<char>& data) : data_(data) { // NOLINT
-    }
-    std::vector<char> data_;
-    int64_t process(const std::shared_ptr<io::BaseStream>& stream) {
-      int64_t ret = 0;
-      if (data_.size() > 0)
-        ret = stream->write(reinterpret_cast<uint8_t*>(&data_[0]), 
gsl::narrow<int>(data_.size()));
-      return ret;
+    explicit WriteCallback(std::vector<char>& data)
+        :data_(&data)
+    { }
+    gsl::not_null<std::vector<char>*> data_;

Review comment:
       I am generally for adding functionality (assignment/move) on a as-needed 
basis, but it is just a preference, I'm fine with the pointer, should we make 
it `const std::vector<char>*`?
   other: do you know any way we could signal that we don't modify the ref 
argument but we wouldn't like to accept temporaries (because we outlive that)?




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