Commit Graph

9 Commits

Author SHA1 Message Date
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00
Ivan Krysak 9f1d9fd5d0 Use Container::contains() where appropriate 2023-07-02 15:06:11 +00:00
Massimo Fioravanti d65d73359d TrackingContainer: review API 2023-04-21 17:49:26 +02:00
Ivan Krysak 3904e525b0 SortedVector: improve new element insertion
This introduces `emplace` and `emplace_or_assign` members
allowing population of the container without copying values in.

It also reworks the batch insertion. On top of adding the ability
to move the elements in (without making a copy) and constructing
them in place, it also makes the non-assign version of the inserter
a lot safer by explicitly asserting the fact that while it was
in use no duplicates were added to the vector. Before now,
the duplicates were just silently removed from the container.

It also optimizes the batch insertion somewhat by using non-stable
`std::sort` for unique case as well as replacing `std::unique`
invocation with `std::find_adjacent`.
2023-03-15 10:19:02 +01:00
Massimo Fioravanti 230036d5b1 Introduce TrackingContainer
TrackingContainer is a wrapper around KeyedObjectContainers (notably,
SortedVector) intended to figure out which elements of the underlying
container have been accessed.
2023-02-16 10:58:02 +01:00
Alessandro Di Federico 47e34bf897 Make MutableSet copiable
We were using a `std::map<const key_t, value_t>` as internal storage,
which was not copiable. This commit drops the `const`.
2021-03-06 16:56:25 +01:00
Alessandro Di Federico 6e6483b5eb Whitespace changes 2021-02-17 11:44:41 +01:00
Alessandro Di Federico 4982ba6922 KeyedObjectContainers: ensure serializability
This commit fixes a couple of bugs preventing SortedVector and
MutableSet from being serialized.
Also, it introduces minimal testing for serialization.
2021-01-28 17:45:14 +01:00
Alessandro Di Federico 8aab914037 Import MutableSet and SortedVector
These data structures are substitutes for a `std::map<Key, Value>` where
`Key` is embedded in `Value`. Their main goal is to be serializable in a
YAML sequence while preserving the order enforced by the key.

`MutableSet` is implemented using a map.
`SortedVector` is implemented using a sorted vector.
2021-01-27 19:46:52 +01:00