Files
Andres Noetzli 661dab0fc0 Change datastructure of CDList to std::vector (#2149)
Before, we were storing elements in a CDList by allocating raw buffers.
When reallocating space, we were moving the elements using memcpy
without invoking the copy or move constructors, which lead to warnings
with GCC 8.1 (and could be problematic, depending on the elements stored
in the list). This commit changes the underlying storage to use
std::vector. This implies a couple of changes: The destructor of the
elements in CDList is now always called, the elements must be
CopyAssignable (which does not work with classes that have const data
members), and some specialization is needed for CDList<bool> because
std::vector<bool> is (possibly) specialized in the STL to be a vector of
bits and doesn't support taking the address of an element. After this
change, the constructor of CDList now takes a `callCleanup` parameter
instead of the `callDestructor` to determine whether the cleanup
function should be called or not when truncating the list (we can
consider removing this parameter altogether in the future since the
default cleanup function is a noop). I've checked the usages of
CDList/CDQueue (which is based on CDList), and this should have no
effect.
2022-11-22 17:31:32 +00:00
..