SFINAE could be a way to perform compile-time introspection: http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error
On Tue, May 26, 2015 at 5:40 PM, Denis Magda <dma...@gridgain.com> wrote: > Yeap, it's not so easy to marshall/unmarshall data in C++. > > Take a look at these slides from NVIDIA: > > http://on-demand.gputechconf.com/gtc/2012/presentations/S0377-C++-Data-Marshalling-Best-Practices.pdf > > The slides are quite high level but probably they will expose a solution > to p.2. > > -- > Denis > > > On 5/26/2015 12:09 PM, Vladimir Ozerov wrote: > >> Igniters, >> >> C++ doesn't have reflection/introspection. For this reason we have to map >> user structs/classes to their marshal/unmarshal handlers (functions) >> somehow. >> >> Various approaches for this are available: >> 1) Predefined map [type ID -> marshal/unmarshal functions] which is >> configured at runtime before Grid is started. >> 2) Provide serializers in runtime. E.g. the following will set specific >> serializers on cache projection: >> ICache* cache = grid.cache(KeySerializer* k, ValSerialzier* v). >> >> I think we should start with p.1 as it is flexible and will not require >> users to change their existing types. The drawback is that user will have >> to write marshalling logic by hand. But we can introduce some >> code-generation facility later (e.g. like Gigaspaces does this). >> >> Thoughts and ideas are welcomed. >> >> Vladimir. >> >> >