Skip to content

Commit

Permalink
TemporaryFile - only use move semantic
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Nov 13, 2024
1 parent 096f73a commit 010d0c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crypto/test/file_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TemporaryFile {
TemporaryFile() = default;
~TemporaryFile();

TemporaryFile(TemporaryFile &other) { *this = std::move(other); }
TemporaryFile(TemporaryFile&& other) noexcept { *this = std::move(other); }
TemporaryFile& operator=(TemporaryFile&&other) {
// Ensure |path_| is empty so it doesn't try to delete the File.
auto old_other_path = other.path_;
Expand All @@ -94,6 +94,9 @@ class TemporaryFile {
return *this;
}

TemporaryFile(const TemporaryFile&) = delete;
TemporaryFile& operator=(const TemporaryFile&) = delete;

// Init initializes the temporary file with the specified content. It returns
// true on success and false on error. On error, callers should call
// |IgnoreTempFileErrors| to determine whether to ignore the error.
Expand Down

0 comments on commit 010d0c1

Please sign in to comment.