Vector can find elements in linear time, hashtable in constant time. That’s a pretty elementary part of computer science. However, better complexity does not always mean it’s faster.
How about defining the variable, initialising it and writing code for serialisation and deserialisation on a single line of code?
It’s somewhat annoying that a factory needs to depend on all classes that inherit from the common interface. This issue can be avoided using a self-registering factory.
C++ has a bad reputation for long times needed for development. However, as this task has shown, it does not deserve this reputation.
Serialisation into human readable formats tends to be a tedious task in programming languages without a lot of reflection. Here is a trick to make it far less repetitive in C++.
An ironic advice about programming… or better to say, an advice how to get fired from your job and then assaulted by me