diff --git a/include/fwk/io/stream.h b/include/fwk/io/stream.h index a0a82329..68c99c59 100644 --- a/include/fwk/io/stream.h +++ b/include/fwk/io/stream.h @@ -47,6 +47,11 @@ template class TStream : public Base { template , EnableIf && is_flat_data>...> void loadData(TSpan &); + template >...> + void saveData(Span); + template && is_flat_data>...> + void loadData(Span); + // TODO: support for serializing vector< >, maybe < > of saveable ? template >...> TStream &operator<<(const T &); template >...> TStream &operator>>(T &); @@ -175,6 +180,16 @@ void TSTREAM::loadData(TSpan &data) { this->loadData(span(data).template reinterpret()); } +TEMPLATE template >...> +void TSTREAM::saveData(Span data) { + this->saveData(data.template reinterpret()); +} + +TEMPLATE template && is_flat_data>...> +void TSTREAM::loadData(Span data) { + this->loadData(data.template reinterpret()); +} + TEMPLATE template >...> TSTREAM &TSTREAM::operator<<(const T &obj) { saveData(cspan(&obj, 1).template reinterpret());