You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A clear and concise description of what the bug is.
emp::array uses std::vector as a backend. For single process jobs, this works fine. For multiprocessing jobs, this creates an issue when passing arrays in messages between processes. Messages will contain pointers to data that allocated on one process that another processes doesn't have.
To my knowledge, there isn't a fundamental reason emp::array is implemented using std::vector. Looking into a quick patch, I found that working with std::vector is more convenient because its iterator is a proper class and therefore you can inherit from it. std::array's iterator is /not/ a class -- it's just a pointer so you can't inherit from it. But with a little elbow grease we should be able to switch out emp::array's backend to be std::array instead. Perhaps @mercere99 can weigh in on this assessment?
The text was updated successfully, but these errors were encountered:
The comments made clear that I used std::vector as the base intentionally (for debug mode only), but I have no recollection why. Have you tried swapping in std::array to see what goes wrong? From your comment above, it sounds like I was more easily able to derive from vector's iterator in order to identify when an iterator have become invalid. Conveniently, the lack of size changes makes this a much rarer situation in arrays.
I have no issues with you making a fix! And if you come up with a reason why it really needs to be vector, please update the docs to indicate. ;-)
Describe the bug
A clear and concise description of what the bug is.
emp::array uses std::vector as a backend. For single process jobs, this works fine. For multiprocessing jobs, this creates an issue when passing arrays in messages between processes. Messages will contain pointers to data that allocated on one process that another processes doesn't have.
To my knowledge, there isn't a fundamental reason emp::array is implemented using std::vector. Looking into a quick patch, I found that working with std::vector is more convenient because its iterator is a proper class and therefore you can inherit from it. std::array's iterator is /not/ a class -- it's just a pointer so you can't inherit from it. But with a little elbow grease we should be able to switch out emp::array's backend to be std::array instead. Perhaps @mercere99 can weigh in on this assessment?
The text was updated successfully, but these errors were encountered: