[odb-users] Change-tracking map, list and set containers
Boris Kolpackov
boris at codesynthesis.com
Tue Jan 15 09:04:01 EST 2019
ALAIN MARI <alain.mari at se.com> writes:
> Sometimes, maps can be advantageously replaced by sorted vectors.
True. Or even unsorted (if you normally have just a handful of elements,
linear search over an unsorted vector can be faster that map lookup due
to data locality).
> Besides, I will try to maintain a vector/map in parallel in some of
> our persistent objects but I'm afraid of memory consumption in that
> case.
You can always get clever and maintain a pointer to the map's element
in the vector or some such. It will require a bit of extra mapping
effort for ODB, but otherwise should be doable.
> I will also look inside your odb::vector implementation to get a
> sense of the complexity, and to see I we can adapt it to std::list.
Yes, I think std::list we can handle using odb::vector's implementation
(vector_impl); off the top of my head I don't see any good reasons to
replicate the list's storage model for the change state.
More information about the odb-users
mailing list