GuillaumeDua / CppShelf

Collection of powerfuls - C++ Single-Header Libraries Files
https://guillaumedua.github.io/CppShelf/
MIT License
9 stars 1 forks source link

[srl] external contract/API: shared marshalling vs. cx-hashed-typeid ? #244

Open GuillaumeDua opened 3 months ago

GuillaumeDua commented 3 months ago

Motivation: To inject either user-defined or internal customizations for given types,
one need to be able to save and retreive such an information prior to the underlying datas.

Actual POCs:

using reader_t = reader_of<int, char, double>;
reader_t::get(input, visitor); // read elements from `input`, and dispatch to `visitor`

Question: Shall we - and if so, how to - remove such compile-time types from reader_of/writer_of ?


One might wanna create a minimalistic marshalling API for basic types (integers, floating-points, strings, and perhaps arbitrary set of bytes), such as:

template <ct_string type_name>
struct marshalling::type{ /*TBD*/ };

// CPOs using marshalling::type<ct_string>
// for instance:

template <csl::ag::aggregate T>
struct marshalling::cpos::size : csl::ag::size<T>{};