OutpostUniverse / OP2Utility

C++ library for working with Outpost 2 related files and tasks.
MIT License
4 stars 0 forks source link

Make FileWriter move constructible #264

Closed DanRStevens closed 5 years ago

DanRStevens commented 5 years ago

This allows FileWriter objects to be returned from functions. A valid copy or move constructor is needed even in the case of copy elision / return value optimization. In that case a copy or move constructor must be defined, even though it is not called.


I encountered the need for this while working on test code. The type parameterized test cases need a factory function to create test objects, so they must be returnable from such functions.

The choice of a move constructor over a copy constructor was largely because the wrapped ofstream object is move constructible, but not copy constructible.