OutpostUniverse / OP2Utility

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

Allow Write of non-trivial types with Write method #282

Closed DanRStevens closed 3 years ago

DanRStevens commented 5 years ago

Non-trivial data types may supply their own Write method.

This addresses Issue #277. Test code should be written to demonstrate this capability before it is merged in. Tests should also verify the new method does not conflict with existing uses of Write. The enable_if guards may need to be checked and tightened up. In particular, it's not currently checking the exact signature of the Write method.

DanRStevens commented 3 years ago

Ahh yes, thank you for poking this. It's been left open for a very long time. I don't really remember what it was waiting on anymore.

Brett208 commented 3 years ago

I added a basic test to prove that it works properly. I'm ok if it merges now. Could probably be some more rigorous testing but I struggled to design the tests.

DanRStevens commented 3 years ago

Ok, I've had a chance to re-read the associated issue. I think I'm fine with merging this now. I had wanted to tighten up the enable_if expression, though it should be good enough for now. We can always update later. Besides, as C++20 becomes mainstream, the new concepts feature may provide a better easier way to tighten up when the Write method can be used.