cereal icon indicating copy to clipboard operation
cereal copied to clipboard

Remove template parameter `Archive` from `InputBindingsMap` and `OutputBindingsMap`

Open uentity opened this issue 7 years ago • 6 comments

Archive isn't directly needed for any content in binding structs and required only to instantiate different global static maps for different archives.

This commit turns InputBindingsMap and OutputBindingsMap into non-templated structs and modifies binding maps to include archive's typeid, such that they describe relation: typeid(Archive) -> per-archive binding map.

That way only two global static objects will be created in runtime (for input and output bindings respectively) in each library/executable. Also types of these globals are independent from included archives and known beforehand.

uentity avatar Sep 25 '18 18:09 uentity

Reason for this change is discussed in issue #508

uentity avatar Sep 25 '18 18:09 uentity

I know that there's one non-related commit with suppressing warnings, but what do you think about the main idea?

It literally changes nothing in public API, but at the same time allows me to unify serialization code across multiple shared libraries.

uentity avatar Oct 05 '18 10:10 uentity

If this works as you say, it would be a great addition since I currently am doing some funky work arounds to make this work correctly across shared library boundaries.

dtmoodie avatar Dec 16 '18 18:12 dtmoodie

@dtmoodie I successfully apply this patch and use it in my project exactly to "unite" serialization code from multiple shared libraries at runtime. Works fine. Because patch is relatively simple and non-affecting. Try it.

uentity avatar Dec 17 '18 04:12 uentity

Great PR!! @AzothAmmo What is missing to accept the merge?

BotellaA avatar Jan 04 '19 08:01 BotellaA

Does this PR still have a chance of being merged? We are facing the same problem as @uentity (separate shared libraries) and we would love to either see this integrated. A workaround would also be great!

@AzothAmmo I am also willing to rebase the PR if necessary. Thanks!

Edit: turns out the rebase is trivial. The rebased code is here.

Edit 2: I have opened a new PR (#812).

arekfu avatar Jan 11 '24 16:01 arekfu