Skip to content

Allow variant deserialization to make types with private constructors#339

Open
KJTsanaktsidis wants to merge 1 commit intoboostorg:developfrom
KJTsanaktsidis:kjtsanaktsidis/fix_private_variant
Open

Allow variant deserialization to make types with private constructors#339
KJTsanaktsidis wants to merge 1 commit intoboostorg:developfrom
KJTsanaktsidis:kjtsanaktsidis/fix_private_variant

Conversation

@KJTsanaktsidis
Copy link

If a type has a private no-args constructor, but has friended boost::serialization::access, it can usually be deserialised as normal. However, it can't be deserialized out of a variant, because the variant tries to invoke the default constructor.

Fix this by constructing it through boost::serialization::access, which is designed to model "classes that can't be created with no arguments except through deserialization"

If a type has a private no-args constructor, but has friended
boost::serialization::access, it can usually be deserialised as normal.
However, it _can't_ be deserialized out of a variant, because the
variant tries to invoke the default constructor.

Fix this by constructing it through boost::serialization::access, which
is designed to model "classes that can't be created with no arguments
except through deserialization"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant