Alexey Serbin has uploaded this change for review. ( http://gerrit.cloudera.org:8080/24962
Change subject: [util] optimize Status move assignment operator ...................................................................... [util] optimize Status move assignment operator The C++ standard doesn't require a lot from source objects of std::move(). At least, for STL objects the requirements are like below [1]: Unless otherwise specified, all standard library objects that have been moved from are placed in a "valid but unspecified state", meaning the object's class invariants hold (so functions without preconditions, such as the assignment operator, can be safely used on the object after it was moved from). Applying this to the Status class, it's possible to postpone deallocating of the internal buffer to the time when the "moved from" Status object goes out of scope, not calling 'delete' in the move assignment operator itself. I also snuck in a fix for KUDU_ATTR_NODISCARD macro's comment. [1] https://cppreference.com/cpp/utility/move Change-Id: Id98a4e4970e3dfc61c22e46ed8fa69393f56aaae --- M src/kudu/util/status-test.cc M src/kudu/util/status.h 2 files changed, 4 insertions(+), 8 deletions(-) git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/62/24962/1 -- To view, visit http://gerrit.cloudera.org:8080/24962 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Id98a4e4970e3dfc61c22e46ed8fa69393f56aaae Gerrit-Change-Number: 24962 Gerrit-PatchSet: 1 Gerrit-Owner: Alexey Serbin <[email protected]>
