If the contents of the parent vector are redistributed after spawning workflows, then their pointers, links, iterators, or something is almost certainly invalid. The list MAY be different (given how they are allocated), but I donโt know and can even be platform dependent.
Basically, if you have multiple workflows, it is probably safe to actually have a parent class method to flush the results back until the copy is tax deductible. Of course, this is not as good as distributing directly in the parent, but then you need to make sure that the container you are throwing into does not get "lost" when redistributing.
If the list that you use is guaranteed not to redistribute its โotherโ space when members are added (or deleted), then this will achieve what you are looking for, but the vector is definitely unsafe. But in any case, the way to access it (pointer, link, or iterator) probably does not matter, since your "root container" is not going to move its contents.
Edit:
As mentioned in the comments below, here is a block about the list from the SGI website (highlighted by me):
Lists have an important property that insertion and splicing do not invalidate iterators to enumerate elements, and that even deleting is invalid only iterators pointing to elements that are deleted. the order of iterators can be changed (that is, the list :: iterator may have a different predecessor or successor after the operation of the list than it was before), but the iterators themselves will not be invalidated or point to different elements if the invalidation or mutation is just Explicit.
So, this basically says โuse the list as your master storeโ, and then each worker can fall into place and knows that he will not be invalidated when the other worker is completely completed and their vector is removed from the list.
Kevin anderson
source share