I am using tbb::concurrent_vector in place of std::vector in some places but am also using boost serialization in order to serialise the containers, and concurrent_vector does not come with one provided (obviously).
Any idea how to implement this easily and correctly?
Many thanks
You can use non-intrusive serialization. The simplest I can think of:
However this would be very wrong, as
concurrent_vector
is apparently not a vector at all:Fix
We can take a hint from e.g.
boost/serialization/list.hpp
and reuse their collection loading/saving primitives. This has the benefit of also adding correct item versioning and NVP wrapping (e.g. needed for XML archives)Demo Time
Live On Coliru
Printing