Make class CAutoFile move-assignable and move-constructible
Summary
We make CAutoFile
be move-assignable and move-constructible. Upon
moving, ownership is transferred from the moved-from object (which becomes
.IsNull()
) to the moved-to object. The moved-to object is then
responsible for closing the file (if any) on destruction.
This is similar to how std::unique_ptr
works and is a common C++
idiom. Since this class is semantically a unique_ptr that has extra
serialization stream smarts, it might be useful to be able to move-assign
and/or move-construct it, and return it from e.g. utility functions.
The motivation for this change is that this move-assign/move-construct behavior may be needed in a future MR.
A unit test was added to test this new feature of the class.
Test Plan
ninja all check-all