Improve serialization functions (#1479)
Improve serialization functions (#1479)

Enable copy ellision and avoid extra allocation for serialization to std::vector. Cleanup.
FFroehlich/AMICI,FFroehlich/AMICI,FFroehlich/AMICI,FFroehlich/AMICI