M
Michael Schuerig
I haven't been using C++ for years and I've never used Boost before, so
I might well be missing something obvious.
I'm using Boost serialization on a class holding a vector of plain
structs. In order to keep anything related to serialization out of the
interface, I have defined free functions for load and save. This works
as expected.
However, for the external representation of the data I need to do a
little bit of mapping from user and group IDs to respective names. I
have another class, Etc, for this task and currently the load and save
functions just have a local Etc variable. This, unfortunately, ties the
code to a specific implementation of the functionality and precludes
caching of mappings in a single Etc instance.
So, what I'm looking for is a way to inject "context" into the load and
save functions that would allow me to keep one Etc instance and pass it
along to where it is needed.
If anyone is interested in the actual code, it can be found here:
https://github.com/mschuerig/preserfs/tree/master/src
Michael
I might well be missing something obvious.
I'm using Boost serialization on a class holding a vector of plain
structs. In order to keep anything related to serialization out of the
interface, I have defined free functions for load and save. This works
as expected.
However, for the external representation of the data I need to do a
little bit of mapping from user and group IDs to respective names. I
have another class, Etc, for this task and currently the load and save
functions just have a local Etc variable. This, unfortunately, ties the
code to a specific implementation of the functionality and precludes
caching of mappings in a single Etc instance.
So, what I'm looking for is a way to inject "context" into the load and
save functions that would allow me to keep one Etc instance and pass it
along to where it is needed.
If anyone is interested in the actual code, it can be found here:
https://github.com/mschuerig/preserfs/tree/master/src
Michael